我目前正在尝试导航到另一个网页,并使用我抓取的超链接获取其 HTML。(我需要存储在上面的信息)。
我目前无法使用我生成的链接获取 PHP curl 函数来获取 HTML 代码。
我试图用来构建/获取 HTML 代码的代码部分是:
foreach($rows as $row)
{
//creating the link itself. https://pr.mo.gov/ is the website itself, the attribute that is returend is the direction location.
// /pharmacy-licensee-search-detail.asp?passkey=1285356, us an example of what I get from getArrtibute('href')
$holder = "https://pr.mo.gov/".$row->getAttribute('href');
// $holder = https://pr.mo.gov/pharmacy-licensee-search-detail.asp?passkey=1285356 as per the example used in the comments above.
echo $holder;
echo "<br>";
//trying to use curl to get the website html
$c = curl_init("$holder");
$html2 = curl_exec($c);
//Trying to print out what has been recived
echo var_dump($html2);
//IT's printing out bool(false)
curl_close($c);
}
这部分之前的代码工作正常——因为它从原始网页中获取了 HTML。如果需要,我会发布它。
慕莱坞森