I have a script set up that I need to log in to a site. All is well and good, and the site goes to redirect. Lets say that the final result I want to see is this:
www.remotesite.com/anydir
However, the final result of the cURL is:
www.mysite.com/anydir
resulting in a 404 error code since I don't have /anydir on my server (it is on the remote server). I have battled with the cURL settings for the past couple days and nothing seems to work. Here is what I have right now:
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_MAXREDIRS, 0);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookiejar');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookiejar');
curl_setopt($ch, CURLOPT_COOKIE, "cookiejar");
This is frustrating! any help would be appreciated