Re: help with include
| From: | O. | Date: | Mon, 07 Aug 2000 19:23:16 +0000 |
| Subject: | Re: help with include | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10521@lists.php.net to get a copy of this message | ||
"Susan G. Long" wrote:
>
> > I'm really green with PHP but I thought I would see if someone
> > can help me with this problem. I have this include statment that
> > works if I put it on a temporary page:
> >
> > I have a
> > script that I want to pull into a section of a page. If I put
> > this statement
> > on a blank page called temp.php3 it works fine:
> >
> > http://www.domain.com/temp.php3
> >
> > <?php
> > include
> > ("http://www.domain.com/stuff/news.shtml");
> > ?>
Can't do that (include does not open HTTP connections; it's for local
files only). Randy Sesser was half right. You'd have to download the
entire file using fopen or some other file function, then include the
downloaded file in your page.
$filein = fopen("url","r");
$fileout = fopen ("filename","w");
while (!(feof($filein))) {
$inputdata = fgets($filein,4096);
fwrite ($fileout, $inputdata);
}
fclose($filein);
fclose($fileout);
include ("filename");
Something like that.
> >
> > If I put this in my phpslash page under one of the blocks from
> > the admin interface, it shows the code in the source instead of
> > pulling the page in...help???
>
> ---------------------------------
> Susan G. Long
> Corporate Project Manager
> sysadmin@up-link.net
> ---------------------------------
> Extra! Extra! Read All About it everyday at
> http://www.up-link.net