PDA

View Full Version : Advanced rss ticker and personal rss feeds



yuengling25
08-20-2013, 01:38 PM
1) Script Title: advanced rss ticker

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/rsstickerajax/

3) Describe problem:
I recently downloaded this script in order to have an rss ticker on my personal website. In testing things out via the demo, I can get everything to work when using the CNN and BBC example feeds that came with the code package. However, when I try to add one of my own feeds to the feed key array, the demo.htm ticker stays stuck at "Initializing ticker..."

Obviously, I'm thinking this has something to do with how my own feed is written. The feed is a php script that parses an espn bottom line url into rss 2.0/xml, and the rss ticker would display things as a live scores ticker. The code for the feed is:


<?



function get_content($url)



{


$ch = curl_init();






curl_setopt ($ch, CURLOPT_URL, $url);



curl_setopt ($ch, CURLOPT_HEADER, 0);







ob_start();






curl_exec ($ch);



curl_close ($ch);



$string = ob_get_contents();






ob_end_clean();






return $string;




}






header("Content-Type: text/xml");



echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";



echo "<rss version=\"2.0\">\n\n";



echo "<channel>\n";


echo "<title>MLB Scores</title>\n";



echo "<link>http://www.mlb.com</link>\n";



echo "<description>MLB Scores</description>\n";



echo "<language>en-us</language>\n";




$content = get_content ("http://sports.espn.go.com/mlb/bottomline/scores");





$content_array=explode("&", $content);



$scorearray = array();



$i=0;



foreach($content_array as $content) {



if (strpos($content, "_left")) {



$equalpos = strpos($content, "=");



$end = strlen($content);



$title = substr($content, ($equalpos+1), $end);



$title = str_replace("^", "", $title);



$title = str_replace("%20", " ", $title);



$title = str_replace("()","(DELAY)", $title);



$title = str_replace(" INNINGS","", $title);



$scorearray[$i]["title"] = $title;







}



if (strpos($content, "_url")) {



$equalpos = strpos($content, "=");



$end = strlen($content);



$url = substr($content, ($equalpos+1), $end);



$url = str_replace("^", "", $url);



$url = str_replace("%20", " ", $url);



$scorearray[$i]["url"] = $url;



$i++;





}



}






foreach($scorearray as $score) {



echo "<item>\n";



echo "<title>".$score["title"]."</title>\n";



echo "<link>".$score["url"]."</link>\n";



echo "</item>\n";



}






echo "</channel>\n";



echo "</rss>\n";



?>

Anyone have any insight as to why things aren't working? Thanks!

jscheuer1
08-20-2013, 02:06 PM
Because that material is probably copyrighted, this might be an illegal request. If it is, we're not allowed to help you.

I suppose I could tell you, just in general that you could validate the feed to gain insight:

http://validator.w3.org/feed/

I'm locking this thread pending a review.

jscheuer1
08-22-2013, 04:24 AM
OK, we've reviewed this matter and it appears that the file on ESPN that you're using is intended only for use by their free branded Bottom Line widget:

http://espn.go.com/bottomline/

It can be put on your website (use IE or Firefox to view link, but the widget works in most browsers):

http://espn.go.com/bottomline/faq.html#gen1

So I would suggest using it instead of grabbing the info for it, which is a violation of ESPN's terms of service. As such we are not allowed by our forum's rules to assist you with doing that anyway.