Reading Remote Files
| From: | Tom Harris | Date: | Tue, 05 Dec 2000 17:18:43 +0000 |
| Subject: | Reading Remote Files | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28727@lists.php.net to get a copy of this message | ||
Hi folks,
I'm having trouble working with a remote file. What I want to do is grab an
HTML file from our partner's site, and remove a chunk of between two html
comments <!--Start border1--> & <!--End border1--> and then display what's
left of the file in the browser.
The first problem is when I do fread it dies in the following code
$filename="http://www.remoteserver.com/thefile.html";
$fp=fopen($filename, "r") or die("couldn't open");
$body=fread($fp, filesize($filename)) or die("couldn't read");
I'm guessing it can't get the filesize from a remote system, is there a way
around this?
Of course after this problem is solved, I have to figure out how to cut out
the chunk of text.