PHP - 从其他网站获取价值

时间:2017-04-12 02:48:37

标签: php regex curl

好吧,我想从其他网站(会员编号)中提取一个值。 就是这样:this

<?php
$CurlStart = curl_init();
curl_setopt ($CurlStart, CURLOPT_URL, "https://ffs-gaming.com/clans.php?
clanid=1264");
curl_setopt ($CurlStart, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($CurlStart, CURLOPT_REFERER, $url);
curl_setopt ($CurlStart, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; 
Windows NT 6.1; nl; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11");
curl_setopt ($CurlStart, CURLOPT_HEADER, 1);
curl_setopt ($CurlStart, CURLOPT_FOLLOWLOCATION, true);
$source = curl_exec ($CurlStart);
curl_close ($CurlStart);

$a=preg_match("/>Members.*.\n.*.>([0-9]*)</",$source,$b);
$members = $b[1];
echo "Members: $members";
?>

这是代码,我在一个论坛上发现它,修改它但它不起作用。

提前致谢!

0 个答案:

没有答案