Jump to content

include question


erichar11

Recommended Posts

In a php file I have the following which does not work

<?php include("rss.php?feed=http://z.about.com/6/g/cameras/b/index.xml&number=10"); ?>

However, this does work

<?php include("http://test.domain.com/rss.php?feed=http://z.about.com/6/g/cameras/b/index.xml&number=10"); ?>

I'd rather use the first since I'm using a test environment and I would rather not hard code the path (test environment domain).

Can someone shed some light. I'm a noob to php.
Link to comment
Share on other sites

Hi all,

the rss file is on my server and in the same directory as the file it's being called from.  I'm not calling an external script on another server. There is no error, just nothing showing up.  You can see it here:

http://dev.myphotomojo.com/tipsarticlesbooks.php

Now if you click on one of the links in the left nav under ""learn about photography" they work since I provided the explicit path in the include statement.

Link to comment
Share on other sites

When you include a file it takes include(filename) so if you put in include("file.php?get=var") it will actually look for a file named "file.php?get=var" which of course will not exist.

For all of the get variables being assigned you could add if(!is_set($var)) { $var = $_GET['var']; } that way you could set the vars in the page you are including the rss file and the vars would remain set.
Link to comment
Share on other sites

You're pulling in about.com's rss feed and attempting to publish it on your site. I don't see anywhere where they say that's allowed.
Have you gotten their permission as stated in #2 of their terms?
Just...out of curiosity. No point in trying to code something you can't even do...
Link to comment
Share on other sites

The only way you can pass variables to an included php page is when your using url wrappers (require full path to be activated), otherwsie, your first include is looking for a local file named...

[code]
rss.php?feed=http://z.about.com/6/g/cameras/b/index.xml&number=10
[/code]
Link to comment
Share on other sites

jesirose,

The site is not live. Yep I realize that may be an issue moving forward, but I was just testing out the capabilities to bring rss feeds to my site via an rss reader.  The feeds will definately change to something more suitable to the site. 

Right now I'm having a tough time just converting the site from html to php.  :(

Thorpe, Corbin,  both your posts makes sense.  Thanks for enlightening me. 
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.