Relative location header - cURL trying localhost

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Relative location header - cURL trying localhost

Post by anjanesh »

For

Code: Select all

.
.
curl_setopt ($handle, CURLOPT_POSTFIELDS, $Data);
curl_setopt ($handle, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt ($handle, CURLOPT_URL, $url);
$c = curl_exec($handle); $Err = curl_errno($handle);
I get this :

Code: Select all

HTTP/1.1 302 Object moved
Date: Wed, 29 Mar 2006 12:46:53 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Location: index.asp?cookieTest=true
Content-Length: 146
Content-Type: text/html
Set-Cookie: ASPSESSIONIDSLRQBTQD=JHMFEOBBLPLPPNJLHAICFHBL; path=/
Cache-control: private

Object Moved
This object may be found here.
If I have CURLOPT_FOLLOWLOCATION set to TRUE then it'll try to goto http://localhost/index.asp?cookieTest=true instead of http://domain.com/index.asp?cookieTest=true - any way to make the url absolute isntead of relative ? I thought cURL took care of all this !
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Relative location headers are not supported by the HTTP standard. cURL follows the standard.
Post Reply