Jump to content

adamci24

New Members
  • Posts

    3
  • Joined

  • Last visited

adamci24's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Awesome I will try this out when I get home. The one question I have is where to I put the actual page URL that this script will search in, In the code above?
  2. Hey guys, I am not great with PHP and am looking for some help getting a script that pulls Div info from a page and echos it as an xml/rss feed. This is for fantasy football, and the code below is an excerpt from the main page taht only shows 1 of 4 matchups for the week. I need to pull the team name and the corresponding score and then pull the opponents name and their score with "VS" text in between them in the final echo line for my rss. So I am looking for the final echo to be something like this example "Doug Flutie 0.00 VS Hellraiser 0.00" Below you will see the current scores (<div class='Fz-lg'>0.00</div>) for both teams which is 0.00 currently. You will also see the team name (<div class='Fz-sm Phone-fz-xs Ell Mawpx-175'><a class="F-link" href="/f1/793293/3">Doug Flutie</a></div>). The one issue I'm seeing is that each teams score uses the same div id of "Fz-lg".... The team name div is unique where there is a number at the end.... <div class='Fz-sm Phone-fz-xs Ell Mawpx-175'><a class="F-link" href="/f1/793293/3">Doug Flutie</a></div> As you can see team "Doug Flutie" is team known as team 3 by "/f1/793293/3"...the last number is 3. Team Hellraisers is team 7 if you look at the code below. Like I said, this is just one of 4 matchups on the site, so this block of code below repeats 3 more times in the same format. The only thing that changes is the last digit for the team name. If I could get this to work id love to have all 4 matchups echoed with the current scores and names. Can anyone help me out with this? Id really appreciate it. Thanks! <div class="Bd No-p Js-submods Tst-matchups-body"> <section class="No-m No-pend Submod Selected"> <p class='Ta-c Fz-xs Pstart-xl Py-med Mbot-sm'>Week 1 - <span class=''>Pre-Game</span></p><ul class="List-rich"><li class='Linkable Listitem No-p ' data-linkable='true' data-target='/f1/793293/matchup?week=1&mid1=3&mid2=7'> <div class='Ta-c Js-hidden'><a href='/f1/793293/matchup?week=1&mid1=3&mid2=7'>View Matchup</a></div> <div class='Grid-table Phone-px-med'> <div class='Grid-u-1-2 Py-med Bdrend'> <div class='Grid-bind-end Grid-h-mid Nowrap'> <div class='Grid-u-1-4 Phone-grid-u-1-3'> <div class='Ta-end Pend-xl Phone-ta-c Phone-no-p'> <div class='Fz-lg'>0.00</div> <div class='F-shade '>173.33</div> </div> </div> <div class='Grid-u Phone-grid-u-2-3'> <div class='Ta-end Grid-h-top Mstart-sm Phone-ta-start Phone-no-mstart'> <div class='Grid-u Va-top Pend-lg Ptop-sm Phone-grid-u-4-5 Phone-no-py Phone-ta-end'> <div class='Fz-sm Phone-fz-xs Ell Mawpx-175'><a class="F-link" href="/f1/793293/3">Doug Flutie</a></div> <div>0-0-0 </div> </div> <span class='Grid-u Pend-lg Phone-grid-u-1-5 Phone-no-px Phone-ptop-med'><a class='Grid-u' href='/f1/793293/3'><img class="Avatar-med Grid-u Mend-med" src="https://i.imgur-ysports.com/CigQjS2s.jpg" alt="avatar"> </a></span> </div> </div> </div> </div> <div class='Grid-u-1-2 Py-med'> <div class='Grid-bind-start Grid-h-mid Nowrap'> <div class='Grid-u-1-4 Phone-grid-u-1-3'> <div class='Pstart-xl Ta-start Phone-ta-c Phone-no-p'> <div class='Fz-lg'>0.00</div> <div class='F-shade '>140.67</div> </div> </div> <div class='Grid-u Phone-grid-u-2-3'> <div class='Grid-h-top Ta-start Mend-sm Phone-no-mend'> <span class='Grid-u Fl-start Phone-grid-u-1-5 Phone-ptop-med'><a class='Grid-u' href='/f1/793293/7'><img class="Avatar-med Grid-u Mstart-med" src="https://s.yimg.com/dh/ap/fantasy/nfl/img/icon_04_100.png" alt="avatar"> </a></span> <div class='Grid-u Va-top Pstart-lg Ptop-sm Phone-grid-u-4-5 Phone-no-py'> <div class='Fz-sm Phone-fz-xs Ell Mawpx-175'><a class="F-link" href="/f1/793293/7">Hellraisers</a></div> <div>0-0-0 </div> </div> </div> </div> </div> </div> </div>
  3. Hi everyone. First post here, hopefully someone can help me out. I am trying to get live NFL scores in the form of an updated RSS feed to send to an LED scrolling sign for my man cave. I have researched this extensively and have found a PHP script that someone wrote that is suppose to pull the scores. The link to the original post is here: http://forum.xda-developers.com/showthread.php?t=272354&page=1 The link that this PHP script scrapes all the data from is: http://sports.espn.go.com/nfl/bottomline/scores If you click the espn link, you can see that it displays data that this PHP script is suppose to parse. Right now it just has an upcoming game on Sunday listed (PIT vs MIN). I put the nfl.php file on my web server and am getting a 404 error when trying to view it in safari. In chrome I see a document tree showing all the ECHO values in the PHP script, in the form of XML/RSS. I guess I'm trying to figure out what I doing wrong when it comes to viewing the output data in an actual RSS feed? The code written below clearly shows echo of data in the form of XML/RSS, so how do I get this into a working RSS feed for my led sign? Is there suppose to be an XML file assoiated? Here is the PHP code: <? 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 "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n"; echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n"; echo "<rss version=\"0.91\">\n\n"; echo "<channel>\n"; echo "<title>NFL Scores</title>\n"; echo "<link>http://www.nfl.com/</link>\n"; echo "<description>NFL Scores</description>\n"; echo "<language>en-us</language>\n"; echo "<image>\n"; echo " <title>NFL Scores</title>\n"; echo " <url>http://www.mpiii.com/scores/nfl.gif</url>\n"; echo " <link>http://www.nfl.com</link>\n"; echo "</image>\n"; echo "<webMaster>info@nfl.com</webMaster>\n"; $content = get_content ("http://sports.espn.go.com/nfl/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); $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"; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.