Advertisement
Guest User

phpforscraping

a guest
Dec 3rd, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?php
  2. include('../simple_html_dom.php');
  3.  
  4. $html = file_get_html('http://www.betexplorer.com/soccer/england/premier-league/results/');
  5.  
  6.  
  7.      
  8. $match_dates = $html->find("td[class=h-text-right h-text-no-wrap]"); // we have 1 per match
  9. $titles = $html->find("td[class=h-text-left]"); // 1 per match
  10. $results = $html->find("td[class=h-text-center]"); // 1
  11. $best_bets = $html->find("span"); // 1
  12. $odds = $html->find("td[class=table-matches__odds]"); // 2
  13.  
  14.  
  15. $c=0; $b=0; $o=0; $z=0; // two counters
  16. foreach ($titles as $match) {
  17.     list($num1, $num2) = explode(':', $results[$o]->innertext); // <- explode
  18.    
  19.     echo "<tr><td class='rtitle'>".
  20.     "<td class='last-cell'>".$match_dates[$c]->innertext . "</td> " .
  21.          "<td class='first-cell tl'>".$match->innertext."</td> "  .  
  22.           "<td class='results'>".$results[$o++]->innertext."</td> "  .        
  23.          "<td class='odds'>".$best_bets[$c++]->attr['data-odd'] . ";" .
  24.          "".$odds[$b++]->attr['data-odd'] . ";" .
  25.          "".$odds[$b++]->attr['data-odd'] . "</td>" .
  26.  
  27.          "</td></tr><br/>";
  28. }
  29.  
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement