2

我正在使用这段代码:

<?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 !Incarca maine !” 或“Se accepta doar voturi din Romania si Republica Moldova”,但我只显示一个空矩形。该网址上的访问权限也应该记录我的IP。curl 会阻止它吗?请帮忙。谢谢。

4

1 回答 1

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>
于 2012-11-24T23:24:20.347 回答