Re: How to include a page not on my host
| From: | php at theOrb dot net | Date: | Fri, 30 Jun 2000 16:37:59 +0000 |
| Subject: | Re: How to include a page not on my host | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4054@lists.php.net to get a copy of this message | ||
Hi Peter,
How about:
<?
$file = "http://www.some.domain/file.nam";
$size = 100000;
if (!$fp = fopen($file, "r") die("Could not open $file for read");
$page = fread($fp, $size);
fclose($fp);
echo $page;
?>
where $size is some arbitrarily large number. fread will read until EOF
or $size, whichever comes first.
good luck,
mike wright
Peter Benoit wrote:
>
> That was even easier than what I came up with, but it returns a number at
> the end, which I guess from the docs is the number of bytes read. Is there
> a way to keep this number from appearing?
>
> -----Original Message-----
> From: TomHenry [mailto:tomhenry@direct-connection.com]
> Sent: Friday, June 30, 2000 12:05 PM
> To: Peter Benoit
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] How to include a page not on my host
>
> Try
>
> readfile("http://whateverdomain/filename.html");
>
> HTH
> Tom Henry
>
> At 11:48 AM 6/30/00 -0400, Peter Benoit wrote:
> >When I try include or require I get:
> >
> >Failed opening required
> >'http://www.xxxxxxxx.com/xxxx.html
> (include_path='')
> >
> >
> >
> >and when I try to use fopen I get:
> >
> >The file exists!Resource id #1
> >