Jump to content
xisto Community
anwiii

Trying To Add A News Feed php in an html page

Recommended Posts

my main pages are html and i want to add php to one or more pages.

i am calling a php page with

<!--#include virtual="/sample.php" -->

i am puting this include within an html page. what's in my sample.php page is
<?php include ("http://rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fsamplenewsfeed&newpage=1&chead=1&atl=&desc=1&owncss=&eleminate=&auth=1&dts=1&width=150&max=20&tlen=0&rnd=&bt=&bs=None&nmb=1&ntb=1&naf=1&nst=1&nwd=600&nht=500&dlen=0&lstyle=-1&lc=Blue&bg=&bc=&spc=&ims=&tc=&ts=11&tfont=Verdana,+Arial,+Sans-serif&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1");?>
i have changed my .htaccess file to include AddType application/x-httpd-php .htm .html

this didn't seem to work so i changed the .htaccess file to include .html server parsed

this didn't seem to work either. any ideas? i feel it's from the server now that i have tried almost everything on my end. i know php is working because my wordpress blog i installed has php pages that load perfectly.

so now i am thinking that maybe php isn't recognizing the feed i am trying to bring up with the code that was given to me. any ideas? all i want to do is get a news feed. grrrrrrrrrrrrr

Share this post


Link to post
Share on other sites

here are the error messages. there are 3 o them...

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/xxxxxx/public_html/sample.php on line 1

Warning: include(http://forums.xisto.com/no_longer_exists/) [function.include]: failed to open stream: no suitable wrapper could be found in /home/xxxxxx/public_html/sample.php on line 1


Warning: include() [function.include]: Failed opening 'http://forums.xisto.com/no_longer_exists/' for inclusion (include_path='.:/usr/lib/http://forums.xisto.com/no_longer_exists/;) in /home/xxxxxx/public_html/sample.php on line 1

the errors are if i try to go to the sample.php file directly. if i try to access the page with the include, i don't get any errors and i just get a blank page. the php code even disappears from the page when i try to view the page source of the sample.php file

i did notice now that the asp tags is turned off in the php configuration cention of my cpanel. would this be the problem since i am using % for part of the url?\

also, when i use javascript to perform the same task, it works the feed is displayed. i quit for now. this is FRUSTRATING

Notice from rvalkass:

Added Quote and Code tags where needed.

Edited by rvalkass (see edit history)

Share this post


Link to post
Share on other sites

I managed to duplicate the error on my local server, but here's what the PHP manual says:

Remote file may be processed at the remote server (depending on the file extension and the fact if the remote server runs PHP or not) but it still has to produce a valid PHP script because it will be processed at the local server. If the file from the remote server should be processed there and outputted only, readfile() is much better function to use. Otherwise, special care should be taken to secure the remote script to produce a valid and desired code.

I was going to suggest similar as a solution. It seems (if i understand this correctly) that the include statement has to receive the remote file unparsed, so instead of including the file, use something like SimpleXML or what is suggested in what i quoted.

Share this post


Link to post
Share on other sites

i appreciate the resource on what could be my problem. to be honest though, i am tired of trial and error and researching things i don't quite understand. why i posted. i wouldn't know where to begin in writing a read file statement and whatever else should be included. if people can just write the code so i can test it, then all the better. i am giving up on it for now though. i have already spent 6 hours trying to solve a problem hat seems to be on the server side. if this is a possibility, maybe smeone can also tell me what sort of problems i could be running in to on the server side that isn't recognizing the code. i would like any information that doesn't require me to learn a language or script. i am burnt out

 

how i have it set up right now is i deleted the server parsed htm and html and just included AddType application/x-httpd-php .htm .htm which will allow me to keep my html extentions but the server will allow php to be run from an html file. so i also just inputed the php code directly in to the html file without creating a new php page and using an include. after many hours, it seems this would be the right way of doing it, but NOPE! my website loads, but no news feed. i view page source and the code cannot be viewed. what should actually be seen in the page source is my original html AND the actual news feed title's and descriptions and text from the feed.

 

js would be different in the sense that i would only see the js code and not the output in the page source. this is why i want to do it with php. seo friendly.

 

I managed to duplicate the error on my local server, but here's what the PHP manual says:

I was going to suggest similar as a solution. It seems (if i understand this correctly) that the include statement has to receive the remote file unparsed, so instead of including the file, use something like SimpleXML or what is suggested in what i quoted.

Edited by anwiii (see edit history)

Share this post


Link to post
Share on other sites

ok. i figured out the problem. i am going to post what the answer was so this thread can be closed. the problem was that the server url includes were turned off. you can use includes within your own pages, but not from outside sources. probably for security purposes and hackers. BINGO. so then i searched out alternatives and truefusion wasn't too far off. there were two solutions that i found one was using this code:

<?require_once($_SERVER['DOCUMENT_ROOT'].'file.php');?>
the other using this one:
<?$a = file_get_contents("http://http://www.somedomain.com/file.php;;echo ($a);?>

i tried them and both seemed to work. although both seemed to work, for rss and atom feeds, they didn't really do enough in what i wanted and how i wanted the feeds to be proccessed so if anyone is reding this and trying to get rss feeds posted on their website and your server wont allow url includes, these two options work. a better option i have found though is just downloading a program called carp. it's a free program and upgradable to do alot more for around $30 for a single user license. if you download a program called grouper, it makes the php scripts that much more powerfull or inserting rss feeds.

ok. that's it folks. after around 10 total hours of trying to figure it out, i have done so. case closed :(

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.