 |
02-02-2005, 05:25 PM
|
#1 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Pffffft
Posts: 8,857
Latest Blog: None
|
Feed doesn't show up?
http://www.must-have-software.net/1.php
How come my feed won't show up? It feeds off of results from Yahoo and I have one for MSN too but it wont work? What gives? Anyone have any other RSS code I could use?
Last edited by Pimpen 2010 : 02-02-2005 at 05:47 PM.
Reason: Title mispelling
|
|
|
02-02-2005, 05:28 PM
|
#2 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
|
Code:
<tr>
<td valign="top"><center><img src="images/newshead.jpg" align="middle"></center></td>
</tr>
<tr>
<td valign="top">
<hr width="100%" align="center" size="1">
</td>
</tr>
<tr>
<td valign="top">
This is the lastest software and freeware news. If you would like to read the archives
of this section, please visit the <a href="/forum/viewforum.php?f=45">News Forum</a>.
</td>
</tr>
cuz their is nothing in the code to show it?
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
02-02-2005, 05:38 PM
|
#3 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Pffffft
Posts: 8,857
Latest Blog: None
|
Naw, there is, here's the code from the page:
Code:
<?php
include ('includes/connect.php');
$page_title = "Software & Freeware Downloads";
include ('includes/header.php');
include ('includes/leftside.php');
?>
<td width="570" valign="top"><!--old width was 380 !-->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td valign="top"><center><img src="images/newshead.jpg" align="middle"></center></td>
</tr>
<tr>
<td valign="top">
<hr width="100%" align="center" size="1">
</td>
</tr>
<tr>
<td valign="top">
This is the lastest software and freeware news. If you would like to read the archives
of this section, please visit the <a href="/forum/viewforum.php?f=45">News Forum</a>.
</td>
</tr>
<tr>
<td valign="top">
<hr width="100%" align="center" size="1">
</td>
</tr>
<tr>
<td valign="top">
<table cellpadding="2">
<td bgcolor="E5EEF8" width="650">
<div align="justify"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000">
<?
$xml_file = "http://news.search.yahoo.com/news/rss?p=Software+Reviews&ei=UTF-8&fl=0&x=wrt";//change this to whatever news feed you want to use
$open_tags = array(
"ARTICLE" => "<ARTICLE>",
"HEADLINE_TEXT" => "<HEADLINE_TEXT>",
"URL" => "<URL>",
"HARVEST_TIME" => "<HARVEST_TIME>",
"SOURCE" => "<SOURCE>"); $close_tags = array(
"ARTICLE" => "</ARTICLE>",
"HEADLINE_TEXT" => "</HEADLINE_TEXT>",
"HARVEST_TIME" => "<HARVEST_TIME>",
"URL" => "</URL>",
"SOURCE" => "</SOURCE>"); $count=0;
function startElement($parser, $name, $attrs=""){
global $open_tags, $temp, $current_tag;
$current_tag = $name;
if ($format = $open_tags[$name]){
switch($name){
default:
break;
}
}
} function endElement($parser, $name, $attrs=""){
global $close_tags, $temp, $current_tag, $count, $numstors;
if ($format = $close_tags[$name]){
switch($name){
case "ARTICLE":
return_page($temp);
$temp = "";
break;
default:
break;
}
}
} function characterData($parser, $data){
global $current_tag, $temp, $catID;
switch($current_tag){
case "HEADLINE_TEXT":
$temp["head"] = $data;
$current_tag = "";
break;
case "URL":
$temp["url"] = $data;
$current_tag = "";
break;
case "SOURCE":
$temp["source"] = $data;
$current_tag = "";
break;
case "HARVEST_TIME":
$temp["time"] = $data;
$current_tag = "";
break;
default:
break;
}
} function return_page(){
global $temp, $count;
$temp["time"] = preg_replace ("/AM/", " a.m.", $temp["time"]);
$temp["time"] = preg_replace ("/PM/", " p.m.", $temp["time"]);
echo "<a href=\"".$temp["url"]."\" target=\"_blank\">".$temp["head"]."</a>\n<br>\n";
echo "[".$temp["source"]."] - ".$temp["time"]."\n<br>\n<br>\n\n";
} $xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement","endElement");
xml_set_character_data_handler($xml_parser, "characterData"); if (!($fp = fopen($xml_file, "r"))) {
die("Could not open $xml_file for parsing!\n");
}
while ($data = fread($fp, 4096)) {
if (!($data = utf8_encode($data))) {
echo "ERROR"."\n";
}
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf( "XML error: %s at line %d\n\n",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
} xml_parser_free($xml_parser);
?></font>
</div>
</td>
</table>
</td>
</tr>
</table>
</td>
<?php
include ('includes/footer.php');
?>
|
|
|
02-03-2005, 08:11 AM
|
#4 (permalink)
|
|
Contributing Member
Join Date: 05-02-04
Posts: 142
Latest Blog: None
|
displaying RSS using PHP
There is a free PHP script at http://www.feedforall.com/free-php-script.htm that is really easy to use. You simply create a template and the script dynamically updates.
HTH
|
|
|
02-03-2005, 09:13 AM
|
#5 (permalink)
|
|
v7n Mentor
Join Date: 02-18-04
Location: Minneapolis, Minnesota
Posts: 1,946
Latest Blog: None
|
Looks like the RSS schema changed by looking at the source (rss) file.
http://news.search.yahoo.com/news/rs...F-8&fl=0&x=wrt
It also looks like yahoo commented out their TITLE and DESCRIPTION fields. It only returns the link but no title or description.
Here is what I am talking about.
http://www.imaginecreativeservices.com/yahoofeed.php
If this is a permanent change you will need to do a string replace/remove of the extra "comments" code (<![CDATA[ ) and (]]>). My sample page does NOT do this.
imaginemn
|
|
|
02-03-2005, 01:26 PM
|
#6 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Pffffft
Posts: 8,857
Latest Blog: None
|
What about the MSN one?
I'll check that out notepage
|
|
|
02-03-2005, 01:32 PM
|
#7 (permalink)
|
|
v7n Mentor
Join Date: 02-18-04
Location: Minneapolis, Minnesota
Posts: 1,946
Latest Blog: None
|
What's the link to the rss or xml file?
imaginemn
|
|
|
02-03-2005, 02:17 PM
|
#9 (permalink)
|
|
v7n Mentor
Join Date: 02-18-04
Location: Minneapolis, Minnesota
Posts: 1,946
Latest Blog: None
|
It works for me.
http://www.imaginecreativeservices.com/msnfeed.php
Here is the code I used.
Code:
<?php
$source = "http://beta.search.msn.com/results.aspx?q=Software+Reviews&format=rss";
$xmlfile = fopen($source, "r");
if(!$xmlfile)die("cannot open the xml file");
$readfile = fread($xmlfile ,40000);
$searchfile = eregi("<item>(.*)</item>", $readfile ,$arrayreg);
$filechunks = explode("<item>", $arrayreg[0]);
$count = count($filechunks);
echo "<table>";
for($i=1 ; $i<=$count-1 ;$i++) {
ereg("<title>(.*)</title>",$filechunks[$i], $title);
ereg("<link>(.*)</link>",$filechunks[$i], $links);
ereg("<pubDate>(.*)</pubDate>",$filechunks[$i], $pubDate);
ereg("<description>(.*)</description>",$filechunks[$i], $description);
echo "<tr><td>";
echo "<a href ='$links[1]'\>$title[1]</a><BR><span class=body>Description: $description[1]</span><BR><BR>";
echo "</td></tr>";
}
echo "</table>";
$xmlfile = "";
$readfile = "";
$searchfile = "";
$filechunks = "";
$count = "";
$source = "";
$i = "";
$links = "";
$title = "";
?>
imaginemn
|
|
|
02-03-2005, 04:05 PM
|
#10 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Pffffft
Posts: 8,857
Latest Blog: None
|
Thanks.
Those boxes you have one yours wont show up on mine right?
|
|
|
02-03-2005, 05:21 PM
|
#11 (permalink)
|
|
v7n Mentor
Join Date: 02-18-04
Location: Minneapolis, Minnesota
Posts: 1,946
Latest Blog: None
|
Quote:
|
Originally Posted by Pimpen 2010
Thanks.
Those boxes you have one yours wont show up on mine right?
|
LOL. No, the logo won't show up either. I just put it there to see the code. I removed the debug code from it and Ur welcome. Glad I could help.
imaginemn
|
|
|
02-03-2005, 05:27 PM
|
#12 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Pffffft
Posts: 8,857
Latest Blog: None
|
Just makin sure cause it's different code  Thanks again man
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:56 AM.
© Copyright 2008 V7 Inc
|
|