Welcome to WebmasterWorld Guest from 54.160.131.144

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

What went wrong with this file read PHP code?

     

irock

11:15 pm on Dec 2, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could someone help me with this error message I got when running a file read PHP line?

Warning: fopen("http://[removed]/info_price.php?masterid=631185", "r") - Success in /home/virtual/site1/fst/var/www/html/hardware/pricegrab.php on line 2

------------------------------------------------
CODE BELOW
------------------------------------------------

$file = fopen ("http://[removed]/info_price.php?masterid=631185", "r");

if ($file) {
$RetrieveFile = fread($file, 128);
if (!ereg("N", $RetrieveFile))
{
$price_temp = $RetrieveFile;
}
fclose($file);
}

print $price_temp;

------------------------------------------------

The $price_temp is supposed to be $163.23, but intead of this, I got the error message. Is there something I did wrong?

Thanks!

Xuefer

3:01 am on Dec 3, 2002 (gmt 0)

10+ Year Member



maybe your domain is resolved to 127.0.0.1 on server, and u didn't config httpd for this ip, just guessing...

irock

3:57 am on Dec 3, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was actually trying to retrieve data from another server. not local.

jatar_k

7:38 pm on Dec 3, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I am not totally sure what is the problem but I did find this

If PHP has decided that filename specifies a registered protocol, and that protocol is registered as a network URL, PHP will check to make sure that allow_url_fopen is enabled. If it is switched off, PHP will emit a warning and the fopen call will fail.

on fopen [php.net], there is a link to protocols on that page as well that may point you in the right direction.