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
fsockopen Not Working
Moderator: General Moderators
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?
Do you use the most recent version of php?
-
kylebragger
- Forum Newbie
- Posts: 7
- Joined: Thu Feb 26, 2004 6:02 am
Re: fsockopen Not Working
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
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);
?>