This is what I have so far but I'm having a TON of trouble figuring out how to do a string replacement.. having never used that command before .
$sports = array(
"NFL" => "http://sports.espn.go.com/nfl/bottomline/scores");
$results = array();
foreach ( $sports as $sport => $url ) {
//get the page pointed to by $url
$page = file_get_contents($url);
//grab all variables out of the page
preg_match_all("/&([^=]+)=([^&]+)/", urldecode($page), $foo);
//loop through all the variables on the page
foreach ( $foo[1] as $key => $value ) {
//debug output, you can delete this next line
//echo "{$value} = {$foo[2][$key]}\t<br />\n";
//this chain of IF/elseif statements is used to determine which pattern to use
//to strip out the correct data, since each sport seems to have its own format
//for the variables you'd "want"
if ( $sport == "NFL" && preg_match("/s_left\d+/", $value) ) {
$results[$sport][] = $foo[2][$key];
}
}
}
//calculate the sport with the most number of rows
$limit = 0;
foreach ( $results as $countMe ) {
$limit = max($limit, count($countMe));
}
//spit out the table with the right headers
echo "<div id='content'>" . implode( array_keys($sports));
//loop until you reach the max number of rows, printing out all the table rows you want
for ( $p = 0; $p < $limit; $p++ ) {
foreach ( array_keys($sports) as $sport ) {
echo "<div id='content1'>{$results[$sport][$p]}</div>";
}
}
//kill the main div
echo "</div>";
Now on the output it puts a ^ next to the winner and I'd like that to be replaced with a *...
Not sure where to put the string replacement command to have it change that output to show the *...
Thanks in advance and I really appreciate your help!!!