Parse(); foreach($parser->document->team as $Team){ $abbrev = $Team ->abbrev[0]->tagData; $abbrev = strtolower($abbrev); $zipCode = $Team ->zipcode[0]->tagData; $timezone = $Team ->timezone[0]->tagData; //Step 1: Gametime .js for team selected $stringForMLB = "http://mlb.mlb.com/".$abbrev."/components/schedule/y2008/schedule.js"; $jsArray = file($stringForMLB); $i=2; while($i"; $StartHour = $hoursUntilGame-1; $EndHour = $hoursUntilGame; if($timezone == "CST") { $StartHour+=1; $EndHour+=1; } if($timezone == "MST") { $StartHour+=2; $EndHour+=2; } if($timezone == "PST") { $StartHour+=3; $EndHour+=3; } $xmlString = "http://datafeed.weatherbug.com/GetXml.aspx?partnerid=0f1a9b2b-d8e3-4974-8dd3-c7756b3f0602&RequestType=600&ThreeHourData=1&StartHour=".$StartHour."&EndHour=".$EndHour."&IconSet=0&ZipCode=".$zipCode; //exception: toronto if($abbrev == "tor"){ $xmlString = "http://datafeed.weatherbug.com/GetXml.aspx?partnerid=0f1a9b2b-d8e3-4974-8dd3-c7756b3f0602&RequestType=600&ThreeHourData=1&StartHour=".$StartHour."&EndHour=".$EndHour."&IconSet=0&ZipCode=".$zipCode; } echo $xmlString."
"; $xml = file_put_contents( "weather/".$abbrev.".xml" , file_get_contents($xmlString) ); $lineOfUpcomingGame = null; unset($StartHour); unset($EndHour); }