我正在尝试使用以下脚本从某个网站提取值,但是我认为这不是有效的 DOM 文档,我想知道是否有其他方法?
<?php
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://www.indiagoldrate.com/gold-rate-in-mumbai-today.htm');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
if (empty($buffer))
{
print "Sorry, example.com are a bunch of poopy-heads.<p>";
}
else
{
print $buffer;
}
?>