Advertisement
Guest User

thank you

a guest
Jun 27th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. ini_set('user_agent',
  2. 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3');
  3. $string = file_get_contents('https://api.linesfeed.info/v1/pregames/lines/pu?sport=golf');
  4. $json_a = json_decode($string, true);
  5. foreach($json_a as $key => $val) {
  6. foreach ($val as $k => $v) {
  7. $curTime = date('H:i');
  8. $sport = 'Golf';
  9. $eventLength = 'FT';
  10. $eDateTemp = explode("T" ,$v['event_DateTimeGMT']);
  11. $eDate = trim($eDateTemp[0]);
  12. $eTime = trim($eDateTemp[1]);
  13. $tourney = trim(trim($v['scheduleText']) . " - " . str_replace("Golf", "", $v['league']));
  14. $rotation_id = $v['participants'][0]['rotNum'];
  15. $VisitorP = $v['participants'][0]['participantName'];
  16. $HomeP = $v['participants'][1]['participantName'];
  17. $VPrice = $v['participants'][0]['odds']['moneyLine'];
  18. $HPrice = $v['participants'][1]['odds']['moneyLine'];
  19. $spreadVisitor = $v['period']['spread']['spreadVisiting'];
  20. $spreadVisitorPrice = $v['period']['spread']['spreadAdjustVisiting'];
  21. $spreadHome = $v['period']['spread']['spreadHome'];
  22. $spreadHomePrice = $v['period']['spread']['spreadAdjustHome'];
  23. $TournamentID = H2HGetTournament($tourney, $connection, $eDate, $sport);
  24. $HID = H2HGetPlayer($HomeP, $connection, $sport);
  25. $VID = H2HGetPlayer($VisitorP, $connection, $sport);
  26. $MatchupID = H2HGetMatchup($TournamentID, $sport, $HID, $VID, $eDate, $eTime, $connection, $rotation_id);
  27. $oldPrice = H2HGetHistory($TournamentID, $MatchupID, $HID, $VID, $connection, $sport, 'FT');
  28. If ($oldPrice['HPrice'] != $HPrice && $oldPrice['VPrice'] != $VPrice && $VPrice != '') {
  29. $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');";
  30. $connection->query($sql);
  31. }
  32. If ($spreadVisitor != "" && $spreadVisitorPrice != "") {
  33. $oldSpread = H2HGetHistorySpread($TournamentID, $MatchupID, $HID, $VID, $connection, $eventLength, $sport);
  34. // some times the spread might change and price stays the same and vice versa so lets check that one is different
  35. If (($oldSpread['spreadVisitorPrice'] != $spreadVisitorPrice) || ($oldSpread['spreadVisitor'] != $spreadVisitor)) {
  36. $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');";
  37. echo $insertRLQuery . "<BR>";
  38. $connection->query($insertRLQuery);
  39. }
  40. }
  41. }
  42. }
  43. $connection->close();
  44. exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement