Page 1 of 1

Problem with using php and curl to access an HTTPS page

Posted: Wed Sep 02, 2009 3:52 pm
by alwaoul
I am using curl commands to read the data from an https page (https://forums.sdn.sap.com/forum.jspa?f ... 97&start=0).

When I run the php file, the file starts executing and the commands are echoed. But then I get transferred to the default homepage (https://www.sdn.sap.com/irj/scn).

Here's the code (which I copied from a website):
$ch=curl_init() or die(curl_error());
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, 'https://forums.sdn.sap.com/forum.jspa?f ... 97&start=0');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST,1);
$data1=curl_exec($ch) ;//or die(curl_error());
echo $data1;

If I use the same code and replace the url with an HTTP one, it works.

Can anyone help?

Re: Problem with using php and curl to access an HTTPS page

Posted: Fri Sep 04, 2009 1:14 pm
by alwaoul
Can anyone help? Please.