Include from another URL?

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-06-2004
x user
 
Posts: n/a
Default Include from another URL?

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
Reply With Quote
  #2 (permalink)  
Old 05-12-2004
DrTebi
 
Posts: n/a
Default Re: Include from another URL?

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


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:03 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0