I had a strange error while programming which spoiled lot of my time. I was trying to fetch a content from an URL through cURL .
The content I am trying to fetch was from server Microsoft-IIS/6.0 powered by ASP.NET. The error I am getting was “eSense Page Implementation Problem Error: Disabled Cookies”. I tried different methods like file_get_contents() but still not worked.
Finally I solved the issue by setting user agent for request header. Below is my working code
$url="http://www.dfm.ae/pages/default.aspx?c=2000&q0=ajmanbank"; $ch = curl_init(); $header[]="User-Agent: Mozilla/5.0"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY, false); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_USERAGENT, ''); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); echo $response = curl_exec($ch); curl_close($ch);
Hope this may help someone else