PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function getHTML($url,$timeout) { $ch = curl_init($url); // initialize curl with given url curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]); // set useragent curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); // max. seconds to execute curl_setopt($ch, CURLOPT_FAILONERROR, 1); // stop when it encounters an error curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); return curl_exec($ch); } $response=getHTML("https://www.betexplorer.com/soccer/japan/j3-league/results/",10); $html = str_get_html($response); $titles = $html->find("a[class=in-match]"); // name match $result = $html->find("td[class=h-text-center]/a"); // result match $c=0; $b=0; $o=0; $z=0; $h=0; // set counters foreach ($titles as $match) { //get all data $match_status = $result[$h++]; if (strip_tags($result[$c]->innertext) == 'POSTP.') { //bypass postponed match $c++; continue; } list($num1, $num2) = explode(':', $result[$c++]->innertext); // <- explode $num1 = intval($num1); $num2 = intval($num2); $num3 = ($num1 + $num2); $risultato = ($num1 . '-' . $num2); list($home, $away) = explode(' - ', $titles[$z++]->innertext); // <- explode $home = strip_tags($home); $away = strip_tags($away); $matchunit = $home . ' - ' . $away; echo "<tr><td class='rtitle'>". "<td> ".$matchunit. "</td> / " . // name match "<td class='first-cell'>" . $risultato . "</td> " . "</td></tr><br/>"; } //close foreach
Show:  
Copy Clear