private function getRatingJson($status) { $fields = array('type' => "normal", 'league_ids' => 3, 'status' => $status, 'auth_code' => "B963EB9EB46B0007", 'start_dt' => rawurlencode($this->start_date), 'end_dt' => rawurlencode($this->end_date)); $fields_string = ""; foreach ($fields as $key => $value) { $fields_string .= $key . '=' . $value . '&'; } rtrim($fields_string, '&'); $json = Utils::download(self::THUUZ_URL . "?" . $fields_string); return json_decode($json); }
private function sendWatchRequest($gameId, $type, $cookie) { $url = Utils::sendPostRequest("http://app.nfl2go.com/Player/Watch", array('code' => $gameId, 'type' => $type), array("Origin: http://app.nfl2go.com", "Referer: http://app.nfl2go.com/Player", "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36"), $cookie); //print_r($url); if ($url["code"] == 200) { return $url; } else { return null; } }
private function getScoresXML() { $file = sprintf("%s/%s/%d_%s_%02d.xml", $this->container->getParameter("nfl_path"), $this->container->getParameter("nfl_data_dir"), $this->year, $this->type, $this->week); $url = sprintf("http://smb.cdnak.neulion.com/fs/nfl/nfl/stats/scores/%s/%s_%s.xml", $this->year, $this->type, $this->week); $xml = Utils::download($url); if (strlen($xml) > 0) { file_put_contents($file, $xml); } else { if (file_exists($file)) { $xml = file_get_contents($file); } else { throw new \Exception("server XMl NOT FOUND"); } } return new \SimpleXMLElement($xml); }