|
Posted by AJ Lemke on 03/24/05 23:10
Hello all,
I have an install of php on a Red Hat Ent. server that is giving me fits.
I have been trying to use the fopen command to retreive files from external
sites and have been getting this error:
Warning: fopen(http://us3.php.net/images/php.gif): failed to open stream:
HTTP request failed! in /home/test/public_html/declare.php on line 2
My code is as follows:
<?
if($handle=fopen("http://us3.php.net/images/php.gif","r")) {
echo "\n\nOPENED REMOTE FILE\n\n";
while (!feof($handle)) {
$buffer = fgets($handle,4096);
echo $buffer;
}
fclose($handle);
}
else
echo "\n\nFAILED TO OPEN REMOTE FILE\n\n";
?>
My Fopen section of my php.ini file.
;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On
; Define the anonymous ftp password (your email address)
;from="john@doe.com"
; Define the User-Agent string
; user_agent="PHP"
; Default timeout for socket based streams (seconds)
default_socket_timeout = 60
; If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
; auto_detect_line_endings = Off
As I stated before This is on a Red Hat Ent Server that is connected to the
internet behind a SonicWall (300 I believe) firewall appliance. I am able
to use the fget command to retrieve files from sites that are also behind
said firewall.
Any help anyone could give me would be greatly appreciated.
AJ Lemke
Navigation:
[Reply to this message]
|