erichar11 Posted January 7, 2007 Share Posted January 7, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/ Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 Read the man entry for [url=http://php.net/include]include[/url], in particular Example 16-7. Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154725 Share on other sites More sharing options...
erichar11 Posted January 7, 2007 Author Share Posted January 7, 2007 thanks, but I have read that prior to me posting. It just doesn't explain why which is what I'm looking for.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154741 Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 Well, Im sorry, but I dont think I could come up with a better description. Its quite simple really. Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154746 Share on other sites More sharing options...
marcus Posted January 7, 2007 Share Posted January 7, 2007 You can't include a php that isn't on your server. It will only read the contents of html, not php. Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154751 Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 [quote]You can't include a php that isn't on your server.[/quote]Sorry, maybe you need to read the manual entry aswell. Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154752 Share on other sites More sharing options...
Jessica Posted January 7, 2007 Share Posted January 7, 2007 what is the error?Is rss.php in the same folder as this file? Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154756 Share on other sites More sharing options...
erichar11 Posted January 7, 2007 Author Share Posted January 7, 2007 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.phpNow 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. Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154779 Share on other sites More sharing options...
Jessica Posted January 7, 2007 Share Posted January 7, 2007 use require() instead of include. that should produce an error. Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154782 Share on other sites More sharing options...
corbin Posted January 7, 2007 Share Posted January 7, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154787 Share on other sites More sharing options...
Jessica Posted January 7, 2007 Share Posted January 7, 2007 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... Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154789 Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 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] Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154790 Share on other sites More sharing options...
erichar11 Posted January 7, 2007 Author Share Posted January 7, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/33172-include-question/#findComment-154805 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.