<?
require_once 'phpQuery.php';
$url = 'http://ruforum.mt5.com/threads/2494-obzor-valyutnogo-rinka-za-nedelyu';
$userName = 'almostsuper';
$htmlPage = file_get_contents($url);
$html = phpQuery::newDocument($htmlPage);
$posts = $html->find('.postdetails');
foreach ($posts as $var) {
$userPost = pq($var)->find('.username > strong:contains('.$userName.')');
if($userPost->text()==$userName)
{
echo '<h1>'.$userName.'</h1>';
$postBody = pq($var)->find('.postbody');
echo $postBody.'<hr/>';
}
}
$rows = $html->find('ol#posts > li > div.postdetails > div.userinfo > div.username_container > div > a.username[href*=3606-sakakolm]');
foreach($rows as $row) {
$msg_html = $row->parent()->parent()->parent()->next()->find('div.postrow > div.content');
}