This is a discussion on Include from another URL? within the PHP General forums, part of the PHP Programming Forums category; Hi there, I'm new to these groups so forgive me if I'm asking at the wrong place (tell ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi there,
I'm new to these groups so forgive me if I'm asking at the wrong place (tell me where then :) Ok, I'm not PHP guru but I need to create a simple script that would do this: Include a content from another URL into the current output. I have done something like this: ------ code start <?php include 'http://myotherurl.com:8080'; ?> ------ code end and it seems to work with one exception: it produces a warning message saying something like "Warning: main(): stream does not support seeking in ..../web-root/index.php on line 9" where line #9 is: include 'http://myotherurl.com:8080'; from above code. It then shows a message from 'http://myotherurl.com:8080' Thanks!!! Nik |
|
|||
|
On Thu, 06 May 2004 13:00:56 -0700, x user wrote:
> Hi there, > I'm new to these groups so forgive me if I'm asking at the wrong place > (tell me where then :) > > Ok, > I'm not PHP guru but I need to create a simple script that would do > this: > > Include a content from another URL into the current output. I have > done something like > this: > > ------ code start > <?php > include 'http://myotherurl.com:8080'; > ?> > ------ code end > > and it seems to work with one exception: it produces a warning message > saying something like > "Warning: main(): stream does not support seeking in > .../web-root/index.php on line 9" > where line #9 is: include 'http://myotherurl.com:8080'; from above > code. > It then shows a message from 'http://myotherurl.com:8080' > > Thanks!!! > Nik Hi Nik, try this, just replace the php.net URL with the one you want: <?php $file = fopen ("http://www.php.net/", "r"); if (!$file) { echo "<p>Unable to open remote file.\n"; exit; } while (!feof ($file)) { $line = fgets ($file, 1024); print $line; } fclose($file); ?> I think the problem with include is that PHP tries to interpret what you are including, instead of displaying it. cheers, DrTebi |