View Single Post
Old 02-01-2013, 05:50 AM   #1 (permalink)
Arunkumar15
The Visitor
Newcomer 
 
Join Date: Feb 2013
Posts: 1
Thanks: 0
Arunkumar15 is on a distinguished road
Default CURLOPT_FOLLOWLOCATION redirection issue

Hi folks,
This is the first time I'm using talkPHP.Hope I'll get a quick solution.
I'm trying fetch HTML of page which is publicly accessible.
here is the code I used.
$home="http://actas.rfef.es...ctas/NPortada";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$home);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_HEADER, TRUE);
curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:18.0)Gecko/20100101 Firefox/18.0");
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch,CURLOPT_COOKIEJAR, "cookies.txt");
echo curl_exec($ch);
curl_close($ch);

Why it redirects even followLocation set to false? How can I avoid being redirected and get html of targeted page?What I'm doing wrong.

I'm struggling with this problem for last 3 days..Please anyone help me on this.Thanks in advance.
Arunkumar15 is offline  
Reply With Quote