Page 1 of 1

fsockopen Not Working

Posted: Sun Sep 21, 2003 4:12 am
by nic9
I am trying to use fsockopen() in PHP and But it's giving me an error. I have tried it on both Windows IIS and Linux redhad 7.3 and Safe Mode is Off but both are unable to connect to any URL.

$fp = fsockopen("http://www.abc.com", "80");

as soon as this code executes it gives me following error:


Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) on line 3

Warning: fsockopen(): unable to connect to http://www.abc.com:80 on line 3

Anybody know why the error is coming

Posted: Sun Sep 21, 2003 9:08 am
by nic9
No, one knows ???

Posted: Sun Sep 21, 2003 9:48 am
by volka
there is a bug report with similar symptoms at http://bugs.php.net/bug.php?id=7880
Do you use the most recent version of php?

Re: fsockopen Not Working

Posted: Mon Apr 05, 2004 3:35 pm
by kylebragger
i get the same error (minus the text about ipv6)
nic9 wrote:I am trying to use fsockopen() in PHP and But it's giving me an error. I have tried it on both Windows IIS and Linux redhad 7.3 and Safe Mode is Off but both are unable to connect to any URL.

$fp = fsockopen("http://www.abc.com", "80");

as soon as this code executes it gives me following error:


Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) on line 3

Warning: fsockopen(): unable to connect to http://www.abc.com:80 on line 3

Anybody know why the error is coming

Posted: Mon Apr 05, 2004 4:32 pm
by ol4pr0

Code: Select all

<?
 //try this to see if this works..

$page = '';
$fh = fopen("http://www.abc.com/example.txt , 'r')
  or die ($php_errormsg);

while(! feof($fh)) {
  $page .= fread($fh,1048576
}
fclose($fh);
?>