Re: CURL redirect not working even with CURLOPT_FOLLOWLOCATION set to true



Sarah wrote:
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);
?>

Did the error go away, or did they just hide it?

Look at phpinfo(). Is either safe_mode or open_basedir set?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: CURL redirect not working even with CURLOPT_FOLLOWLOCATION set to true
    ... settings as I used to be able to get CURL to follow redirects by ... away, but I still can't seem to follow redirects, but I don't receive ... but it would be a lot easier if the CURL ... // close CURL resource, ...
    (comp.lang.php)
  • Re: CURL redirect not working even with CURLOPT_FOLLOWLOCATION set to true
    ... settings as I used to be able to get CURL to follow redirects by ... away, but I still can't seem to follow redirects, but I don't receive ... but it would be a lot easier if the CURL ... // close CURL resource, ...
    (comp.lang.php)
  • Re: OT: backup on another server
    ... readfile and imagecreate might not work with remote urls (depends on url_fopen settings on your main server) so you might have to get pictures using fopen or curl to your main server and then show them in the way you've done it before. ... Also you can use socket functions, You should be able to get pictures via HTTP as well although some parsing will be nessesary. ...
    (comp.lang.php)
  • CURL redirect not working even with CURLOPT_FOLLOWLOCATION set to true
    ... 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 ... away, but I still can't seem to follow redirects, but I don't receive ... but it would be a lot easier if the CURL ...
    (comp.lang.php)
  • Re: redirects disappearing
    ... restore an old metabase file, since this information is stored in the ... May i also ask what tool you used to edit IIS settings? ... a few days ago all of these redirects vanished. ... > I haven't been able to reproduce the disappearing redirects however by testing various IP and security settings. ...
    (microsoft.public.inetserver.iis)