[PHP] fopen with URL gives me a problem

2001-03-24 Thread marco trevisani


Hi,
i'm running   php3 3.3.0.18  on Debian (but i had the same problem with
Red Hat) w/ Apache 1.3.14.
(the same code with php3 3.3.0.16/15 was working finethen did i
uppgrade... I had too:-(  )

I had a simple, or what i expect to be simple.., call:
(it just check temperature in a city...in this case Habana, from the
noaa server
and print simply the part i need, This was perfectly working with php3
3.3.015, you can check www.icmc2001.org)

Now i get a  error window saying: "Document contained no data"
I suspect it has something to do with $wfile = fopen (see code
below)

Does anybody know if it is a bug or if it is something that changed  in
that release?
 (i would apreciate if you can also reply to my email address)

thank you,
marco trevisani

--code-

$noaa  = "http://weather.noaa.gov/cgi-bin/mgetmetar.pl?=MUHA" ;
$wfile =  fopen ($noaa, "r");


$weathcont = fread ($wfile , 1024);

ereg (" ([0-9][0-9])/([0-9][0-9]) " , $weathcont, $reg);

$far = 32 + ( $reg[1] / (5.0 / 9.0));
$data = date("d F");
$ora = (date("H")-6);

echo "
Temperature in Habana, on $data, at ";
if ($ora < 0){
 $timezone = ($ora + 24);
 echo $timezone;
}else{
 echo $ora ;
}
echo "  is:
$reg[1] C ($far F)";
fclose($wfile);

end of code --


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] stil problems with fopen and URL

2001-03-26 Thread marco trevisani

Sorry for re posting this problem, but after spending a bunch of hours
still there is something "misterious" to me: can you find anything broken
in this code?
(Again it works fine with 3.3.0.15 and 3.3.0.16 but is broken with
3.3.0.18, on
Debian, apache).


$noaa  = "http://weather.noaa.gov/cgi-bin/mgetmetar.pl?=MUHA" ;
$wfile =  fopen ($noaa, "r");


$weathcont = fread ($wfile , 1024);

ereg (" ([0-9][0-9])/([0-9][0-9]) " , $weathcont, $reg);

$far = 32 + ( $reg[1] / (5.0 / 9.0));
$data = date("d F");
$ora = (date("H")-6);

echo " Temperature in Habana,
on $data, at "; if ($ora < 0){
 $timezone = ($ora + 24);
 echo $timezone;
}else{
 echo $ora ;
}
echo "  is:
$reg[1] C ($far F)";
fclose($wfile);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]