Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $domain = "https://www.betfair.it/exchange/cashout";
- $ch = curl_init($domain);
- //curl_setopt($ch ,CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL, $domain); // Setting cURL's URL option with the $url variable passed into the function
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Setting cURL's option to return the webpage data
- //curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
- $response = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable
- curl_close($ch); // Closing cURL
- //$response = curl_exec($ch);
- preg_match_all("/<span class=\"in-play-icon inplay\">(.*?)</", $response, $matchedinplay);
- preg_match_all("/<span class=\"home-team\">(.*?)</", $response, $matchedhome);
- preg_match_all("/<span class=\"away-team\">(.*?)</", $response, $matchedaway);
- preg_match_all("/<span class=\"result\">(.*?)</", $response, $matchedresult);
- preg_match_all("/<div class=\"start-time\">(.*?)</", $response, $matchedtime);
- //print_r($matchedinplay);
- $fp = fopen('results.json', 'w');
- for ($i = 0; $i < count($matchedinplay[1]); $i++) {
- $trans = array("'" => "", "1º Tempo" => "45");
- $rtime = strtr($matchedtime[1][$i],$trans);
- $time = str_replace("'","",$matchedtime[1][$i]).str_replace("45","1º Tempo",$matchedtime[1][$i]);
- $def = "80";
- if($time >= $def){
- $isok = "OK";
- }else{
- $isok = "NO";
- }
- echo "#".$i." ".$matchedhome[1][$i]." - ".$matchedaway[1][$i]." - ".$matchedresult[1][$i]." - ".$rtime." ".$isok."\r\n";
- fwrite($fp, json_encode($matchedhome[1][$i]));
- }
- fclose($fp);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement