Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- function getTextBetweenTags($string, $tagname) {
- $pattern = "/<$tagname.*?>(.*?)<\/$tagname>/";
- preg_match_all($pattern, $string, $matches);
- return $matches;
- }
- echo "<div><h1>Livescore leecher</h1></div>";
- echo "<div><a href='http://livescore.com/euro-2012/match/?match=A_570674'>Link </a></div>";
- $html = file_get_contents("http://livescore.com/euro-2012/match/?match=A_570674");
- //match in source
- preg_match('/<td class="match-dark" ?.*>(.*)<\/td>/', $html, $match);
- //print_r($match);
- //echo $match[0];
- echo "<br>";
- //match only detail;
- preg_match('#match details(.*)statistics#', $match[0], $detail);
- //Remove "match details" and "statistics"
- $current = array("match details :", "statistics", "'", " ");
- $replace = array("", "", "", "");
- $match_events = str_replace($current, $replace, $detail[0]);
- //$removed_single_quote = str_replace("'", "", $match_events);
- //echo $match_events;
- $arr = getTextBetweenTags($match_events, "td");
- //remove [1 - 0]
- $ret = preg_replace('#\[.*?\]#', "", $arr[1]);
- $emptyRemoved = array_filter($ret);
- print_r($emptyRemoved);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement