Я не знаю, почему я не могу получить результат?
Вот часть моего PHP-кода:
Код: Выделить всё
//$html , successfuly get the html from "http://m.hkgolden.com/topics.aspx?type=HW" by curl
$dom = new DOMDocument();
@$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
$xpath->registerNamespace('x', 'http://www.w3.org/1999/xhtml');
$itemList = $xpath->query('//x:div[contains(@class,"TopicBox_Details")]/a');
var_dump($itemList); // it show --> object(DOMNodeList)#4 (0) { }
foreach ($itemList as $item){
$this->child_urls[] = $item->getElementsByTagName('a')->item(0)->getAttribute('href');
}
var_dump($this->child_urls); //it show --> array(0) { }

Подробнее здесь: https://stackoverflow.com/questions/117 ... p-domxpath
Мобильная версия