CURL redirect not working even with CURLOPT_FOLLOWLOCATION set to true
- From: Sarah <Sarah.Bashaw@xxxxxxxxx>
- Date: Thu, 24 Jul 2008 14:30:05 -0700 (PDT)
I was wondering if someone might be able to help me with this issue.
I have a feeling this has something to do with my host's server
settings as I used to be able to get CURL to follow redirects by
setting CURLOPT_FOLLOWLOCATION set to true. I had a problem with my
host's updating something in the past that gave me the error
"CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an
open_basedir is set". My host worked on the issue and the error went
away, but I still can't seem to follow redirects, but I don't receive
the error. When I turn on the headers it show the location redirect,
but it won't follow it. Any ideas or is this an issue again with my
host? One code example of this issue is below. I have been able to
manually redirect to a point, but it would be a lot easier if the CURL
option worked. Thanks for any help you can provide.
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_setopt($ch, CURLOPT_URL, "http://www.flickr.com/signin/");
curl_setopt($ch, CURLOPT_REFERER, "http://www.flickr.com/");
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type:
application/x-www-form-urlencoded"));
//curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_exec ($ch);
curl_close($ch);
?>
.
- Follow-Ups:
- Re: CURL redirect not working even with CURLOPT_FOLLOWLOCATION set to true
- From: Jerry Stuckle
- Re: CURL redirect not working even with CURLOPT_FOLLOWLOCATION set to true
- Prev by Date: Re: notice and warning
- Next by Date: Re: Simpler way to do this?
- Previous by thread: User agent fingerprinting
- Next by thread: Re: CURL redirect not working even with CURLOPT_FOLLOWLOCATION set to true
- Index(es):
Relevant Pages
|