PHP cURL 在某些时候没有显示部分内容

PHP cURL not showing a part of content from some point

我为完成这项工作苦苦挣扎了一段时间,但似乎遗漏了一些东西。场景是这样的:
我正在尝试通过 DOMXpath 查询使用 PHP 和 cURL 从网站获取一些信息。直到某个点我才得到任何信息,从那个点和下面我什么都得不到……空白。我使用的脚本如下:

$target_url = "https[:]//[www][.]bankofalbania[.]org/Tregjet/Kursi_zyrtar_i_kembimit/"; //Remove [ and ] from url
$userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)';

$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 1000);

$html= curl_exec($ch);
if (!$html) {
    echo "<br />cURL error number:" .curl_errno($ch);
    echo "<br />cURL error:" . curl_error($ch);
    exit;
}

// parse the html into a DOMDocument
$document = new DOMDocument();
libxml_use_internal_errors(true);
$document->loadHTML($html);
libxml_clear_errors();
$selector = new DOMXPath($document);

$anchors = $selector->query('/html/body/div[1]/section[1]/div/div[2]/div[2]/div[2]/div/table[1]/tbody/tr[1]/td[1]');
    foreach($anchors as $div) { 
        $value = $div->nodeValue;
        echo $value;
}

有趣的是,如果 $anchors 更改为此
$anchors = $selector->query('/html/body/div[1]/section[1]/div/div[2]/div[2]/div[2]/div/table[1]');
内容摘自网站。另外,我应该提到我已经尝试将查询更改为更直接的内容,如下所示:

$anchors = $selector->query('//table[@class="table table-sm table-responsive w-100 d-block d-md-table table-bordered m-0"]/tbody/tr[1]/td[3]');

但结果是一样的...null! 我不知道我在这里错过了什么,但我做不到 运行。 我期待得到的是 $target_url.
页面的 table 的美元价值 提前谢谢你:-)

html 中没有 tbody 标签,与 Javascript 不同,PHP 不会自动添加它(使用开发人员时请记住这一点浏览器提供的工具)。美元的金额也在第三个单元格中,因此正确的 XPath 查询是:

/html/body/div[1]/section[1]/div/div[2]/div[2]/div[2]/div/table[1]/tr[1]/td[3]