PHP function used to open (Internet or Unix domain) sockets connections.
Questions tagged [fsockopen]
382 questions
75
votes
11 answers
php_network_getaddresses: getaddrinfo failed: Name or service not known
Here is a snippet of my code
$fp = fsockopen($s['url'], 80, $errno, $errstr, 5);
if($fp){
fwrite($fp, $out);
fclose($fp);
When I run it, it outputs:
unable to connect to www.mydomain.net/1/file.php:80 (php_network_getaddresses:…

Rob
- 7,980
- 30
- 75
- 115
63
votes
8 answers
How to check if a file exists from a url
I need to check if a particular file exists on a remote server. Using is_file() and file_exists() doesn't work. Any ideas how to do this quickly and easily?

David
- 16,246
- 34
- 103
- 162
53
votes
7 answers
Socket transport "ssl" in PHP not enabled
I'm having trouble enabling the socket transport "ssl" in PHP. When I run my script, I get the error:
Warning: fsockopen()
[function.fsockopen]: unable to
connect to ssl://www.my.site.com:443
(Unable to find the socket transport
"ssl" -…

jelina
- 841
- 1
- 6
- 9
36
votes
6 answers
Unable to find the socket transport "https"
I'm using this to check for the availability of a URL:
$fp = fsockopen($url, 443, $errno, $errstr);
and I get this error back...
Warning: fsockopen() [function.fsockopen]: unable to connect to https://example.com/soapserver.php:443 (Unable to find…

Chris J Allen
- 18,970
- 20
- 76
- 114
21
votes
1 answer
How do I get SSL working in fsockopen?
I'm running PHP 5.2.6 on Windows, I have extension=php_curl.dll and extension=php_openssl.dll uncommented in php.ini; as such I can see the following in phpinfo:
curl
cURL support enabled
cURL Information libcurl/7.16.0 OpenSSL/0.9.8g…

soapergem
- 9,263
- 18
- 96
- 152
13
votes
1 answer
Connecting to WebDAV with PHP?
I'd like to connect to WebDAV using PHP, and be able to upload files, etc. However, I cannot figure out how to connect to it. I imagine it would ultimately be as simple as opening a socket and sending the proper headers/commands, but I don't know…

Rob
- 7,980
- 30
- 75
- 115
12
votes
4 answers
Which is better approach between fsockopen and curl?
I am creating an app for Automated Recurring Billing.
Please let me know which option should I opt for sending the request to server
fsockeopen
curl
and why one is better than another?

Gaurav
- 28,447
- 8
- 50
- 80
11
votes
10 answers
PHP Post data with Fsockopen
I am attempting to post data using fsockopen, and then returning the result.
Here is my current code:

Joseph Robidoux
- 351
- 2
- 6
- 13
9
votes
2 answers
Something faster than get_headers()
I'm trying to make a PHP script that will check the HTTP status of a website as fast as possible.
I'm currently using get_headers() and running it in a loop of 200 random urls from mysql database.
To check all 200 - it takes an average of 2m 48s.
Is…

Clarkey
- 698
- 3
- 11
- 28
9
votes
1 answer
Preventing warnings from fsockopen
I use fsockopen() to connect to multiple servers in a loop.
However some servers are not valid and I get PHP warnings like the one below:
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: The requested name is…

PeeHaa
- 71,436
- 58
- 190
- 262
8
votes
2 answers
Sending emails from PHPMailer using proxies IP addresses
I need to send emails from PHPMailer using proxies IP addresses, I know that to do so, I need to use the fsockopen function so I can connect to the SMTP account, I also know that if I have to connect to the proxy I have to use the fsockopen function…

Zakaria Acharki
- 66,747
- 15
- 75
- 101
8
votes
2 answers
Reading data from fsockopen using fgets/fread hangs
Here is the code that I am using:
if (!($fp = fsockopen('ssl://imap.gmail.com', '993', $errno, $errstr, 15)))
echo "Could not connect to host";
$server_response = fread($fp, 256);
echo $server_response;
fwrite($fp, "C01…

victor_golf
- 195
- 2
- 2
- 10
7
votes
1 answer
live audio stream socket get stuck in browser
I'm trying to setup a page where several (private) streams can be listened from.
Unfortunately I'm not able to get it running. I tried Using php to opening live audio stream on android already, but for some reason the browser get stuck when loading…

Kootsj
- 431
- 3
- 12
7
votes
1 answer
php fsockopen how to know if connection is alive
I've a problem with php fsockopen command.
I need to open a socket connection on a server to implement a message exchange.
If the server does not receive anything from my (client) side, it close the connection after a certain timeout (that I don't…

Stefano Radaelli
- 1,088
- 2
- 15
- 35
7
votes
4 answers
multi-thread, multi-curl crawler in PHP
Hi everyone once again!
We need some help to develop and implement a multi-curl functionality into our crawler. We have a huge array of "links to be scanned" and we loop throw them with a Foreach.
Let's use some pseudo code to understand the logic:
…

Chris Russo
- 450
- 1
- 7
- 21