| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) | ||||
| NamePros Regular Join Date: Dec 2006
Posts: 236
![]() | |
| Quote: |
|
</b> <div class="text">PC World - PC World editors Tim Moynihan and Robert Strohmeyer sit down with Macworld editorial director Jason Snell for a breakdown of all this week's Apple news from WWDC. In the mix: What to expect from the iPhone 3G S, long-awaited features on the new MacBook Pro laptops, and how Snow Leopard will improve the Mac experience. Yes, it's all Apple stuff this week, and our editors don't pull their punches. <br /><a href="http://www.google.de/gwt/n?u=us.rd.yahoo.com/dailynews/rss/cellphones/*iPhone 3G S, New MacBook Pros, and Snow Leopard on PC World Podcast 33 by PC World: Yahoo! Tech " target="_blank">Read the Rest of This Story</a></div><br /> <b>Even PCers Like Apple's Safari as Downloads Top 11M (NewsFactor) </b> |
<?
$var = @$_GET['z'] ;
$var2 = @$_GET['q'] ;
echo "<h4> Yahoo! News - $var2</h4>";
$feed_url = "http://$var"; // change to the feed you wish to use!
class RSSParser {
var $insideitem = false;
var $tag = "";
var $title = "";
var $description = "";
var $link = "";
function startElement($parser, $tagName, $attrs) {
if ($this->insideitem) {
$this->tag = $tagName;
} elseif ($tagName == "ITEM") {
????: NamePros.com http://www.namepros.com/programming/589986-php-and-rss.html
$this->insideitem = true;
}
}
function endElement($parser, $tagName) {
if ($tagName == "ITEM") {
print "
<b>" . $this->title . "</b>
<div class=\"text\">" . $this->description . "<br /><a href=\"" . $this->link . "\" target=\"_blank\">Read the Rest of This Story</a></div><br />";
????: NamePros.com http://www.namepros.com/showthread.php?t=589986
$this->title = "";
$this->description = "";
$this->link = "";
$this->insideitem = false;
}
}
function characterData($parser, $data) {
if ($this->insideitem) {
switch ($this->tag) {
case "TITLE":
$this->title .= $data;
break;
case "DESCRIPTION":
$this->description .= $data;
break;
case "LINK":
$this->link .= $data;
break;
}
}
}
}
$xml_parser = xml_parser_create();
$rss_parser = new RSSParser();
xml_set_object($xml_parser,&$rss_parser);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen("$feed_url","r")
or die("Error reading RSS data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);
?>
| | THREAD STARTER #3 (permalink) |
| NamePros Regular Join Date: Dec 2006
Posts: 236
![]() | No I am not using Wordpress, just XHTML & PHP. Isn't There a way to place the link [PHP]www.google.de/gwt/n?u=[PHP] within the print after the <a href=\"" . ? But I don't think this will work because if I understand this code correctly the "&this" variable is [PHP]http://www.google.de/gwt/n?u=us.rd.yahoo.com/dailynews/rss/cellphones....?[PHP] ????: NamePros.com http://www.namepros.com/showthread.php?t=589986 PHP Code: |
| | |
| | #4 (permalink) |
| I'll do it ![]() Join Date: Dec 2005 Location: India
Posts: 6,927
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP Code: From that Yahoo RSS URL's and append the Error in front of it before printing each element.
__________________ |
| | |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| RSS Traffic! Feed your RSS to Many sites in seconds! RSS Traffic Detonator. | lazyleo | For Sale / Advertising Board | 1 | 05-19-2007 04:23 AM |
| 83 scripts for sell | cesarian | Scripts For Sale | 3 | 02-16-2007 08:00 AM |
| Anyone know a php script that convert rss to text file? | cesarian | Programming | 1 | 08-18-2006 02:45 PM |
| Submit your articles and news releases easy to RSS feed services | Hostnetric | Content For Sale | 4 | 12-24-2005 08:45 AM |