Advertisement
FamiHug

leecher

Jun 18th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <?
  2. function getTextBetweenTags($string, $tagname) {
  3.     $pattern = "/<$tagname.*?>(.*?)<\/$tagname>/";
  4.     preg_match_all($pattern, $string, $matches);
  5.     return $matches;
  6. }
  7.  
  8.  
  9. echo "<div><h1>Livescore leecher</h1></div>";
  10.  
  11. echo "<div><a href='http://livescore.com/euro-2012/match/?match=A_570674'>Link </a></div>";
  12. $html = file_get_contents("http://livescore.com/euro-2012/match/?match=A_570674");
  13.  
  14. //match in source
  15. preg_match('/<td class="match-dark" ?.*>(.*)<\/td>/', $html, $match);
  16. //print_r($match);
  17. //echo $match[0];
  18. echo "<br>";
  19. //match only detail;
  20. preg_match('#match details(.*)statistics#', $match[0], $detail);
  21. //Remove "match details" and "statistics"
  22. $current = array("match details :", "statistics", "'", "&nbsp;");
  23. $replace = array("", "", "", "");
  24. $match_events = str_replace($current, $replace, $detail[0]);
  25. //$removed_single_quote = str_replace("'", "", $match_events);
  26. //echo $match_events;
  27.  
  28. $arr = getTextBetweenTags($match_events, "td");
  29. //remove [1 - 0]
  30. $ret = preg_replace('#\[.*?\]#', "", $arr[1]);
  31. $emptyRemoved = array_filter($ret);
  32.  
  33. print_r($emptyRemoved);
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement