Reading a file from another server
| From: | Thomas | Date: | Fri, 25 Jul 2003 21:49:38 +0000 |
| Subject: | Reading a file from another server | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-156941@lists.php.net to get a copy of this message | ||
Hi Everyone.
I'm having problems creating code to read a file from another server.
1. Is this even possible? with a secure server aswell?
2. I have tried using fopen() but this always gives me an error:
Warning: stat failed for http://www.domain.com/test.txt
(errno=2 - No such
file or directory) in /home/domain/public_html/php/testphp/test.php on line
4
this is my code:
<?php
$filename = "http://www.domain.com/test.txt";
$handle = fopen ($filename, "r");
$content = fread($handle, filesize ($filename));
fclose($handle);
echo $content;
?>
can anyone help me. I need to put this on my server, and read this other
file form a game server....but I can't seem to do it.
Cheers for any help