Problem w/ fopen
Moderator: General Moderators
Problem w/ fopen
Hello:
I'm having difficulties with the following. I'm using Windows 98 with the latest Apache and PHP:
if(!($myFile=fopen('http://www.fborfw.com/strip_fix/','r')))
{
echo "Sorry, the FBorFW strip is under maintenance.";
exit;
}
The following error is returned:
Warning: php_hostconnect: connect failed in c:\program
files\apache group\apache\htdocs\test1.php on line 14
Warning: fopen("http://www.fborfw.com/strip_fix/", "r") - Bad
file descriptor in c:\program files\apache
group\apache\htdocs\test1.php on line 14
The strange thing is, this works fine on Windows 2000. Anyone have any clues?
Thanks
I'm having difficulties with the following. I'm using Windows 98 with the latest Apache and PHP:
if(!($myFile=fopen('http://www.fborfw.com/strip_fix/','r')))
{
echo "Sorry, the FBorFW strip is under maintenance.";
exit;
}
The following error is returned:
Warning: php_hostconnect: connect failed in c:\program
files\apache group\apache\htdocs\test1.php on line 14
Warning: fopen("http://www.fborfw.com/strip_fix/", "r") - Bad
file descriptor in c:\program files\apache
group\apache\htdocs\test1.php on line 14
The strange thing is, this works fine on Windows 2000. Anyone have any clues?
Thanks
Yes, I have no problem using fopen for local html files on my c drive. But I would like to grab a URL from a website (as in the example I gave), not a local file on my c drive.
(Typing in http://localhost/test1.php in my browser accesses c:\program files\apache group\apache\htdocs\test1.php.)
What is strange is that I'm able to open the html page from the website I want (referenced in my php code) on a Win2k machine with the same Apache and PHP configurations. Why would it behave differently on a Win98 machine?
(Typing in http://localhost/test1.php in my browser accesses c:\program files\apache group\apache\htdocs\test1.php.)
What is strange is that I'm able to open the html page from the website I want (referenced in my php code) on a Win2k machine with the same Apache and PHP configurations. Why would it behave differently on a Win98 machine?
Too
I've got the same problem.
The allow_url_fopen is On.
The server's parameters:
Version: PHP 4.0.6
System: Linux porky.devel.redhat.com 2.4.18-0.1smp #1 SMP Wed Feb 27 07:25:23 EST 2002 i686 unknown
WEB-Server: Apache 1.3.22
It seems to be a bug?
The allow_url_fopen is On.
The server's parameters:
Version: PHP 4.0.6
System: Linux porky.devel.redhat.com 2.4.18-0.1smp #1 SMP Wed Feb 27 07:25:23 EST 2002 i686 unknown
WEB-Server: Apache 1.3.22
It seems to be a bug?
Code: Select all
if(!($myFile=fopen('http://www.fborfw.com/strip_fix/','r')))Yes, he really forgot the filename, but for me still don't works:
Code: Select all
$file = file('http://weather.noaa.gov/pub/data/observations/metar/stations/LHBP.TXT');When i try to open the file from a browser, I get it normally.
On FreeBSD
I am sure that Falco's code is correct. His example works for me as follows:
I get back the array output from the LHBP.TXT file. I would suggest checking out the PHP setup in the php.ini file. It is possible it is a compiler problem, but it does work on FreeBSD using php v. 4.2.2
Code: Select all
<?php
$file = file('http://weather.noaa.gov/pub/data/observations/metar/stations/LHBP.TXT');
print_r($file);
?>