Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ini_set('user_agent',
- 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3');
- $string = file_get_contents('https://api.linesfeed.info/v1/pregames/lines/pu?sport=golf');
- $json_a = json_decode($string, true);
- foreach($json_a as $key => $val) {
- foreach ($val as $k => $v) {
- $curTime = date('H:i');
- $sport = 'Golf';
- $eventLength = 'FT';
- $eDateTemp = explode("T" ,$v['event_DateTimeGMT']);
- $eDate = trim($eDateTemp[0]);
- $eTime = trim($eDateTemp[1]);
- $tourney = trim(trim($v['scheduleText']) . " - " . str_replace("Golf", "", $v['league']));
- $rotation_id = $v['participants'][0]['rotNum'];
- $VisitorP = $v['participants'][0]['participantName'];
- $HomeP = $v['participants'][1]['participantName'];
- $VPrice = $v['participants'][0]['odds']['moneyLine'];
- $HPrice = $v['participants'][1]['odds']['moneyLine'];
- $spreadVisitor = $v['period']['spread']['spreadVisiting'];
- $spreadVisitorPrice = $v['period']['spread']['spreadAdjustVisiting'];
- $spreadHome = $v['period']['spread']['spreadHome'];
- $spreadHomePrice = $v['period']['spread']['spreadAdjustHome'];
- $TournamentID = H2HGetTournament($tourney, $connection, $eDate, $sport);
- $HID = H2HGetPlayer($HomeP, $connection, $sport);
- $VID = H2HGetPlayer($VisitorP, $connection, $sport);
- $MatchupID = H2HGetMatchup($TournamentID, $sport, $HID, $VID, $eDate, $eTime, $connection, $rotation_id);
- $oldPrice = H2HGetHistory($TournamentID, $MatchupID, $HID, $VID, $connection, $sport, 'FT');
- If ($oldPrice['HPrice'] != $HPrice && $oldPrice['VPrice'] != $VPrice && $VPrice != '') {
- $sql = "INSERT INTO BM_" . $sport . ".BO" . strtoupper($sport) . "_" . $eventLength . "_MATCHUPS (idTournament, idMatchup, inputDate, inputTime, idP1, idP2, P1ML, P2ML) VALUES ('$TournamentID', '$MatchupID', CurDate(), '$curTime', '$HID', '$VID', '$HPrice', '$VPrice');";
- $connection->query($sql);
- }
- If ($spreadVisitor != "" && $spreadVisitorPrice != "") {
- $oldSpread = H2HGetHistorySpread($TournamentID, $MatchupID, $HID, $VID, $connection, $eventLength, $sport);
- // some times the spread might change and price stays the same and vice versa so lets check that one is different
- If (($oldSpread['spreadVisitorPrice'] != $spreadVisitorPrice) || ($oldSpread['spreadVisitor'] != $spreadVisitor)) {
- $insertRLQuery = "INSERT INTO BM_" . $sport . ".BO" . strtoupper($sport) . "_" . $eventLength . "_SPREAD (idTournament, idMatchup, idP1, idP2, spreadVisitor, spreadVisitorPrice, spreadHome, spreadHomePrice, inputDate, inputTime) VALUES ('$TournamentID', '$MatchupID', '$HID', '$VID', '$spreadVisitor', '$spreadVisitorPrice', '$spreadHome', '$spreadHomePrice', CurDate(), '$curTime');";
- echo $insertRLQuery . "<BR>";
- $connection->query($insertRLQuery);
- }
- }
- }
- }
- $connection->close();
- exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement