&nba_s_delay=120&nba_s_stamp=0306085718&nba_s_left1=^Boston%20109%20%20%20Philadelphia%20101%20(FINAL)&nba_s_right1_1=P.%20Pierce%2018pts,%207ast,%2011reb&nba_s_right1_2=J.%20Holiday%2018pts,%2010ast,%205reb&nba_s_right1_count=2&nba_s_url1=http://sports.espn.go.com/nba/boxscore?gameId=400278616&nba_s_left2=LA%20Lakers%20105%20%20%20^Oklahoma%20City%20122%20(FINAL)&nba_s_right2_1=K.%20Bryant%2030pts,%202ast,%203reb&nba_s_right2_2=R.%20Westbrook%2037pts,%205ast,%2010reb&nba_s_right2_count=2&nba_s_url2=http://sports.espn.go.com/nba/boxscore?gameId=400278617&nba_s_left3=^Denver%20120%20%20%20Sacramento%20113%20(FINAL)&nba_s_right3_1=T.%20Lawson%2024pts,%207ast,%203reb&nba_s_right3_2=I.%20Thomas%2023pts,%208ast,%203reb&nba_s_right3_3=D.%20Cousins%205%20blocks&nba_s_right3_4=M.%20Thornton%205-11%20three%20pointers&nba_s_right3_count=4&nba_s_url3=http://sports.espn.go.com/nba/boxscore?gameId=400278618&nba_s_count=3&nba_s_loaded=true
Il parametro nell'URL è la "/nba/".
Questo programma prende la stringa di output, e la splitta:
Debug delle coppie nome/valore:
nba_s_delay=120 nba_s_stamp=0306072047 nba_s_left1=Boston 109 Philadelphia 101 (FINAL) nba_s_right1_1=P. Pierce 18pts, 7ast, 11reb nba_s_right1_2=J. Holiday 18pts, 10ast, 5reb nba_s_right1_count=2 nba_s_url1=http://sports.espn.go.com/nba/boxscore?gameId=400278616 nba_s_left2=LA Lakers 105 Oklahoma City 122 (FINAL) nba_s_right2_1=K. Bryant 30pts, 2ast, 3reb nba_s_right2_2=R. Westbrook 37pts, 5ast, 10reb nba_s_right2_count=2 nba_s_url2=http://sports.espn.go.com/nba/boxscore?gameId=400278617 nba_s_left3=Denver 120 Sacramento 113 (FINAL) nba_s_right3_1=T. Lawson 24pts, 7ast, 3reb nba_s_right3_2=I. Thomas 23pts, 8ast, 3reb nba_s_right3_3=D. Cousins 5 blocks nba_s_right3_4=M. Thornton 5-11 three pointers nba_s_right3_count=4 nba_s_url3=http://sports.espn.go.com/nba/boxscore?gameId=400278618 nba_s_count=3 nba_s_loaded=true
Versione PHP originale, che crea un RSS:
\n\n"; echo "\n\n"; echo "\n\n"; echo " \n"; ?>\n"; echo " \n"; echo "NBA Scores \n"; echo "http://www.nba.com\n"; echo "NBA Scores \n"; echo "en-us \n"; echo "\n"; echo " \n"; echo "NBA Scores \n"; echo "http://www.mpiii.com/scores/nba.gif \n"; echo " http://www.nba.com\n"; echo "info@nba.com \n"; $content = get_content ("http://sports.espn.go.com/nba/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 "- \n"; echo "
\n"; } echo "".$score["title"]." \n"; echo "".$score["url"]."\n"; echo "
Trovato qui e qui.
Elenco di tutti i parametri/feed di espn.
Sono i dati utilizzati dall'applicazione ESPN Bottomline.