【发布时间】:2016-06-14 10:39:22
【问题描述】:
我尝试在 div 上返回一个数字,我想要“01 55 33 44”
<div data-phone="01 55 33 44" class="agency_phone ">
Phone
</div>
我试过了:
$url = "myurl";
$raw = file_get_contents($url);
preg_match('/<div data-phone="(.*)"class="agency_phone "/isU',$raw,$output);
echo $output[1];
我没有回报, 有人有想法吗?
提前致谢。
【问题讨论】:
-
请详细说明您的代码和问题以便更好地理解。
-
我尽力了,只是想找回电话号码。
-
data-phone="([^"]+)" class -
但是使用dom解析器做任务是正确的
标签: php html class file-get-contents