PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Dr Evil
Forum Contributor
Posts: 184 Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland
Post
by Dr Evil » Tue Dec 20, 2005 5:13 pm
I'm having problems with an include function.
Code: Select all
<?php
include ("http://service.rssvp.com/mason/rssvp/feed.html?id=424");
?>
or
Code: Select all
<?php
include ("http://service.rssvp.com/mason/rssvp/feed.php?id=424");
?>
the urls work fine but used in an include I get an error:
Warning: main(
http://service.rssvp.com/mason/rssvp/feed.html?id=424 ): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in ...
See it here:
http://www.worldwatchreport.com/rss.php
I tried including other files with variables and had no trouble.
Any of you wizards know what the problem is? Thanks
Swede78
Forum Contributor
Posts: 198 Joined: Wed Mar 12, 2003 12:52 pm
Location: IL
Post
by Swede78 » Tue Dec 20, 2005 5:35 pm
If you're using PHP version prior to 4.3.0, a remote file won't work with include(). You may be better off using readfile() instead, depending on what you intend to do with the page you're inclduing.
trukfixer
Forum Contributor
Posts: 174 Joined: Fri May 21, 2004 3:14 pm
Location: Miami, Florida, USA
Post
by trukfixer » Tue Dec 20, 2005 6:17 pm
actually you cant include the php code itself as a file - all you are going to get from a HTTP request is the output of the file.
if you want to include the output file into your PHP page, there's better ways than include()
you could use file_get_contents and then echo that out, for example..
Code: Select all
$include_this = file_get_contents('http://service.rssvp.com/mason/rssvp/feed.html?id=424');
echo $include_this;
Buddha443556
Forum Regular
Posts: 873 Joined: Fri Mar 19, 2004 1:51 pm
Post
by Buddha443556 » Tue Dec 20, 2005 6:36 pm
Check to make sure "allow_url_fopen" is on?
Dr Evil
Forum Contributor
Posts: 184 Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland
Post
by Dr Evil » Wed Dec 21, 2005 2:43 am
I'm afraid none of the above solutions gave any results.
using
Code: Select all
<? ini_set('allow_url_fopen', 'on');?>
<?
$include_this = file_get_contents('http://service.rssvp.com/mason/rssvp/feed.html?id=424');
echo $include_this;
?>
I get an error:
http://www.worldwatchreport.com/rss2.php
BUT I tried including this page
Code: Select all
<? include("http://forums.devnetwork.net/viewtopic.php?p=225299"); ?>
And it works OK:
http://www.worldwatchreport.com/rss3.php
Could it be a problem on the rssvp.com server side?
Dr Evil
Forum Contributor
Posts: 184 Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland
Post
by Dr Evil » Thu Dec 22, 2005 10:49 am
I have fiddled around with it and it certainly is a problem on the "included" server side