...

View Full Version : php file() fail to open stream error



ldaves
08-15-2008, 10:37 AM
i use same code in 2 different version of php


<?php
echo "<pre>";
$b = file('http://localhost:8080');
print_r($b);
?>


php 5.0.2 return me no error message


Array
(
[0] =>

[1] =>

[2] =>

[3] => "http://www.w3.org/TR/html4/loose.dtd">

[5] =>

[6] =>

[7] =>

[8] =>

[9] =>

[10] =>

[11] =>

[12] => Hello World!

[13] =>

[14] =>

)


However php 5.2.6 return me error message


Warning: file(http://localhost:8080/) [function.file]: failed to open stream: No such file or directory in /export/home/test1.php on line 3



any advice how can i solve the problem?

hinch
08-15-2008, 05:01 PM
try

$fp = @fopen("http://localhost:8080","r");
print_r($fp);

ldaves
08-15-2008, 08:16 PM
it return



Warning: fopen(http://localhost:8080) [function.fopen]: failed to open stream: No such file or directory in /export/home/test.php on line 6

Looks like fopen failed too. :S

hinch
08-15-2008, 10:06 PM
odd don't really have any other suggestions sorry

oesxyl
08-16-2008, 05:19 PM
odd don't really have any other suggestions sorry
there is nothing odd and @ don't make anything then hidding error messages


i use same code in 2 different version of php

<?php
echo "<pre>";
$b = file('http://localhost:8080');
print_r($b);
?>

php 5.0.2 return me no error message

However php 5.2.6 return me error message


Warning: file(http://localhost:8080/) [function.file]: failed to open stream: No such file or directory in /export/home/test1.php on line 3



any advice how can i solve the problem?

http://www.php.net/manual/en/function.fopen.php

http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum