this puzzled me for a few days£¬when I use the function 'fopen' with following :
<?php
$url = "http://www.php.net";
$handle = fopen ( $url, "rb");
$contents = "";
while( true ) {
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
}
$contents .= $data;
}
fclose ($handle);
var_dump( $contents );
?>
I got 2 warnings when I run it:
Warning: fopen(): php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /usr/local/apache2/htdocs/heshun/kkk/zz.php on line 2
Warning: fopen(http://www.php.net): failed to open stream: Invalid argument in /usr/local/apache2/htdocs/heshun/kkk/zz.php on line 2
I have checked the relating conf 'allow_url_fopen' is 'on' in 'php.ini' more than once and I can be sure have no problems here because I run it by shell prompt with following when I log into my local net(BSD OS, PHP 4.3.10 ) :
test# php -a zz.php
It can work well ! why it happened this case? a bug? how can I resolve it ? I'm too urgent 🙁 and wait for help online