Jump to content

Refining...:)


cowboysdude

Recommended Posts

Well with help from this community I have my NFL score board working!! First off HUGE Thanks to the willingness of you guys to help all of us!! Many of us are here to learn [i hope no one is here just to scrap code ..]... I like learning this stuff.. it's really interesting!!Ok now that it's working I'd like to throw some ideas out there and see what you guys think... Currently this is what I have...<?php$url="http://www.nfl.com/liveupdate/scorestrip/postseason/ss.xml";$ch = curl_init();curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_URL, $url); // get the url contents$data = curl_exec($ch); // execute curl requestcurl_close($ch);$xml = simplexml_load_string($data); echo "

"; echo "
nfl.png
"; echo "NFL Playoffs"; foreach($xml->gms->g as $games) { if(!empty($games['vtn'])) { if (($games['q']) == 'F') { echo "

",$games['gt']," ",$games['htn']," ",$games['hs']," ",$games['vtn']," ",$games['vs'],"  Final

"; } else { echo "

",$games['gt']," ",$games['htn']," ",$games['hs']," ",$games['vtn']," ",$games['vs']," ",$games['d']," at ",$games['t'], "

"; } } } echo "
";?>It outputs the scores and if the 'htn' or 'vtn' variables are empty it skips them! So it'll output the team their score the visiting team their score and the time or Final if it's over... Currently this is a line from the output [for example]WC Pittsburgh Steelers 17 Baltimore Ravens 30 FinalThis tells people it was a Wild Card game the teams the final.What I would like to understand is how to 'date' something so after a certain time it won't show anymore...say it shows that score for 7 days then no longer...As with the xml there are WCDIVCONSBThese are all objects I can work with however the xml outputs them all... As I said what I'd like to do is make them 'time limited' so they no longer show... here is a line from the xml:g eid="2015010301" gsis="56492" d="Sat" t="8:15" q="F" htn="Pittsburgh Steelers" hnn="steelers" h="PIT" hs="17" vtn="Baltimore Ravens" vnn="ravens" v="BAL" vs="30" n="NBC" rz="0" ga="" o="1" gt="WC"/I'm pretty sure the eid is a date the first 7 is the actual date of the game... so what I was thinking if I take that 7 digit number and add 7 to it once that reaches the number +7 no to show up anymore...Not really sure how to do that... I was thinking this: ($xml->eid as $exmple)If (($games['eid'] == $example +7) { echo "nothing"; }else echo "game info";Thanks for your help!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.