我正在使用此代码:
<?php
error_reporting(E_ALL);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.csservers.ro/voteaza/cs.mnx.ro');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.csservers.ro/evidenta/cs.mnx.ro');
$html = curl_exec($ch);
curl_close($ch);
echo $html;
?>
最终的结果应该是“Ip-ul sau clasa asta a mai votata odata!Incearca maine!” 或“Se accepta doar voturi din Romania si Republica Moldova”但我只显示一个空矩形。 该URL上的访问也应记录我的IP。卷曲阻止了吗? 请帮忙。感谢。
答案 0 :(得分:0)
我添加了
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11');
现在html以
结尾<p>Se accepta doar voturi din Romania si Republica Moldova </p>