preg match - PHP get div that contains a word -
i'm trying divs contain [release] @ bottom of page http://mpgh.net/forum/175-crossfire-hacks-cheats/.
<?php $text = file_get_contents("http://mpgh.net/forum/175-crossfire-hacks-cheats/"); $check_hash = preg_match('#<div class=\"inner\"> <h3 class=\"threadtitle\"> <a href="\.*?\" id=\".*?\"><img class=\".*?\" src=\".*?\" alt=\"go first new post\" title=\"go first new post\"></a> <img src=\".*?\" alt=\".*?\" border=\"0\" title=\".*?\"> <span class=\"prefix understate\"> <span style=\".*?\"><b>(.*?)</b></span> </span> <a class=\"title threadtitle_unread\" href=\"(.*?)\" id=\".*?\">(.*?)</a> </h3> <div class=\"threadmeta\"> <div class=\"author\"> <span class=\"label\">started by <a rel=\"nofollow\" href=\"(.*?)\" class=\"username understate\" title=\"started (.*?) on .*?\">.*?</a>.*?</span> </div> </div> </div>#', $text, $match); print_r($match);
i tried doesn't work, i'm confused because can't find solution this.
thanks.
use simple html dom:
try code:
require_once('simple_html_dom.php'); $html = file_get_html('http://mpgh.net/forum/175-crossfire-hacks-cheats/'); $ret = $html->find('div[class=inner]',0); echo $ret->innertext;
Comments
Post a Comment