Hi everyone. I once again need some help programing. What
I would like to do is add the following link in the beginning of the
“Read the Rest of This Story” link.
This is the link to insert:
www.google.de/gwt/n?u=
This is what I would like the source code to look like, is it possible?
I would like to do is add the following link in the beginning of the
“Read the Rest of This Story” link.
This is the link to insert:
www.google.de/gwt/n?u=
This is what I would like the source code to look like, is it possible?
</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>
PHP:
<?
$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") {
$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 />";
$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);
?>






