Page 1 of 1

fopen doesn't work with https

Posted: Wed Sep 02, 2009 12:33 pm
by alwaoul
I am trying to collect data from an https page using php.

When I run my php file with fopen("https://forums.sdn.sap.com/forum.jspa?f ... 97&start=0, "r") , I get the following message
Warning: fopen(https://forums.sdn.sap.com/forum.jspa?f ... 97&start=0) [function.fopen]: failed to open stream: No error in C:\xampp\htdocs\the_name_of_my_php_file.

I followed the instructions at http://www.leoganda.net/how-to-enable-x ... transport/
So I tried modifying my php.ini, and replacing libeay32.dll and ssleay32.dll as instructed. Now fopen works but instead of running the php file, all what is displayed is the homepage for the https i am interested in (i.e. I get defaulted to https://www.sdn.sap.com/irj/scn rather than display the content of https://forums.sdn.sap.com/forum.jspa?f ... 97&start=0)

Any suggestions?

Re: fopen doesn't work with https

Posted: Wed Sep 02, 2009 3:16 pm
by alwaoul
I think I made some progress. But I am still unsuccessful.

I am using curl commands instead of fopen. Yet I am still transferred to the default homepage https.

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;