Question

I am using this code:

<?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;
?>

The end result should be "Ip-ul sau clasa asta a mai votata odata ! Incearca maine !" or "Se accepta doar voturi din Romania si Republica Moldova" but i get displayed just an empty rectangle. Also the acces on that url should record my ip. Does curl block that ? Please help. Thanks.

Was it helpful?

Solution

I added

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');

and now html ends with

<p>Se accepta doar voturi din Romania si Republica Moldova </p>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top