Current location: Hot Scripts Forums » Programming Languages » PHP » Using Google News RSS w/PHP


Using Google News RSS w/PHP

Reply
  #1 (permalink)  
Old 09-19-05, 10:46 AM
AndrewZ AndrewZ is offline
Newbie Coder
 
Join Date: May 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Using Google News RSS w/PHP

Hello,

I was wondering how you use the Google News feed? I know how to get the XML page that I would like to display on my site, but dont know how to parse it so it does display

Examples w/ it on are
www.denzelwashington.info
www.christyhemme.info

Help would be MUCH appriciated.

Thanks!
__________________
Lance Armstong - A site dedicated to an American Cyclist, Cancer Survivor, and most of all, Hero.
Reply With Quote
  #2 (permalink)  
Old 09-19-05, 12:36 PM
nekeno12 nekeno12 is offline
Wannabe Coder
 
Join Date: May 2004
Location: CO
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
http://magpierss.sourceforge.net/

We already have it in place and it works like a charm.
Reply With Quote
  #3 (permalink)  
Old 09-19-05, 01:53 PM
AndrewZ AndrewZ is offline
Newbie Coder
 
Join Date: May 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by nekeno12
http://magpierss.sourceforge.net/

We already have it in place and it works like a charm.
I was looking at that but find it very hard to follow because of lack of installation/use instructions
__________________
Lance Armstong - A site dedicated to an American Cyclist, Cancer Survivor, and most of all, Hero.
Reply With Quote
  #4 (permalink)  
Old 09-19-05, 02:00 PM
nekeno12 nekeno12 is offline
Wannabe Coder
 
Join Date: May 2004
Location: CO
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
Alright, here's the lowdown. This came straight from my code. So you'll need to change the include path, and whatever other code you need to change.

PHP Code:

<?php
require_once('magpierss/rss_fetch.inc');
$namepart $urlkeyword;
$url "http://news.google.com/news?q=$urlkeyword&output=rss";
$rss fetch_rss$url );
echo 
"Channel Title: " $rss->channel['title'] . "<p>";
echo 
"<ul>";
foreach (
$rss->items as $item) {
$href $item['link'];
$title $item['title'];
$desc $item['description'];
echo 
"<li><a href=$href>$title</a></li>";
echo 
"$desc";
}
echo 
"</ul>";?>
Reply With Quote
  #5 (permalink)  
Old 09-19-05, 02:41 PM
AndrewZ AndrewZ is offline
Newbie Coder
 
Join Date: May 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
For some reason that code comes up as an error for me. Check LanceFans.com

I appriciate your help
__________________
Lance Armstong - A site dedicated to an American Cyclist, Cancer Survivor, and most of all, Hero.
Reply With Quote
  #6 (permalink)  
Old 09-19-05, 05:02 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
http://www.lancefans.com/index.htm <- that might be why it's not working. You're not getting an error, just straight PHP code. You have to use PHP files to parse PHP code.
Reply With Quote
  #7 (permalink)  
Old 09-19-05, 06:55 PM
AndrewZ AndrewZ is offline
Newbie Coder
 
Join Date: May 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you, that got it!
__________________
Lance Armstong - A site dedicated to an American Cyclist, Cancer Survivor, and most of all, Hero.
Reply With Quote
  #8 (permalink)  
Old 10-05-05, 10:57 AM
AndrewZ AndrewZ is offline
Newbie Coder
 
Join Date: May 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for the help so far, I have one more question though...

I am getting some good SE traffic from people searching for headlines, but am curious if there is any scripts that allow you to archive the news articles on your own site so that they will be more benificial for SE purposes.

Anyone know?
__________________
Lance Armstong - A site dedicated to an American Cyclist, Cancer Survivor, and most of all, Hero.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple News System? (which supports RSS) DannyK Script Requests 0 08-14-05 06:11 PM
Software Marketing News - January notepage General Advertisements 0 01-03-05 07:57 AM
Displaying multiple RSS feeds (news site) kongen Script Requests 0 12-15-04 03:21 AM
Making an RSS news feed Merovingian PHP 4 09-30-04 09:14 AM
Sept Software Marketing News notepage General Advertisements 0 09-02-04 10:46 AM


All times are GMT -5. The time now is 06:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.