curl-and-php
RE: problem while redirecting with curl to an https
Date: Fri, 7 May 2004 09:26:18 -0500
I have read manuals.
$ch= curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.foo.com");
$arg= Array();
$arg['desc']='...';
$arg['cartId']='...';
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $arg);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_exec ($ch);
curl_close ($ch);
The above code works fine, it passes all the POST parameters to the
requested page and shows the page, however all relative uri in the
second page are taking the first page domain as their base uri, the page
url isn't shown etc.
The http reference doc rfc2616 (downloadable from w3.org) is pretty
strainght about the headers on a request, on a simple redirect with php
header("Location: http://www.foo.com"); works fine except for POST
methods.
I included these two lines:
$header[]="Location: https://https://www.foo.com";
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
As a result of your reply to a previous post of mine on the Curl
discussion list in haxx.es where you made a comment saying I needed to
send the proper headers.
The documentation of curl is pretty scarce as in
http://www.php.net/manual/en/ref.curl.php where there is a list of
predefined constants that can be used with curl_setopt function but not
an explanation of the constants.
The doc found in http://curl.haxx.se/docs/httpscripting.html handles the
Curl library from the command line.
Please indicate me which other manuals should I read.
Lizet
-----Original Message-----
From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: Friday, May 07, 2004 1:27 AM
To: using curl with PHP
Subject: RE: problem while redirecting with curl to an https
On Thu, 6 May 2004, Lizet Peņa de Sola wrote:
> $header[]="Location: https://https://www.foo.com,*.*";
> curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
I think you need to stop this and go back to reading manuals before
proceeding.
The code above attemts to send a Location: header to the remote server
you requst the HTTPS page from. That has no effect what so ever.
-- Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se Dedicated custom curl help for hire: http://haxx.se/curl.htmlReceived on 2004-05-07