我是php的新手,我想从html过滤数据,这是我的代码
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://lookup-id.com/',
CURLOPT_USERAGENT => 'Sample cURL Request',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => 'fburl=https%3A%2F%2Fwww.facebook.com%2Fzuck&check=Lookup'
));
$resp = curl_exec($curl);
curl_close($curl);
echo $resp;
$rr = preg_match('/\<p id\=\"code-wrap\"\>\<span id\=\"code\"\>/' , $resp);
?>
此脚本返回了我整个HTML页面,但是我只需要一些数据,例如: 1- Facebook帐户名称 2- Facebook帐户的数字ID
我如何从输出中过滤掉这两件事?
我只需要这部分
Success! If Facebook name is Mark Zuckerberg, then we found your numeric
ID:
4