Hello everyone, I need some help on some advanced level. I need to post some information to ssl page and read of the response. I know how to post to a regular (not encrypted) page using curl functions, but using this method for ssl pages does not return any responses from the remote server (although it seems like the post information is passing through). As far as i figured out i need to have openSSL installed and configured - which i do. So if someone could help me out with just some sample code of posting to https page would really appreciate it.
I have done it before. Can not find my code on this box though. Will look around for the code in the eve. Please send me a PM as reminder.
The notes on the PHP manual page for curl_setopt seem to be helpful. http://www.php.net/manual/en/function.curl-setopt.php Specifically, it looks like you should set the option CURLOPT_SSL_VERIFYPEER to FALSE.
Ok, I found the code...I am not using curl, I am using sockopen You can change it per your need. Here it is: $sock = fsockopen("ssl://select.worldpay.com",443); if(!$sock) { return "ERROR"; } else { $sock = fsockopen("ssl://select.worldpay.com",443); fputs($sock, "POST /wcc/authorise HTTP/1.0\r\n"); fputs($sock, "Host: www.YourWShost.com\r\n"); fputs($sock, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($sock, "Content-length: " . strlen($data) . "\r\n"); fputs($sock, "Accept: */*\r\n"); fputs($sock, "\r\n"); fputs($sock, "$data\r\n"); fputs($sock, "\r\n"); $tmp_headers = ""; while ($str = trim(fgets($sock, 4096))) $tmp_headers .= $str."\n"; $tmp_body = ""; while (!feof($sock)) $tmp_body .= fgets($sock, 4096); fclose($sock);
hello,curl absolutely is able to post ssl pages,as the php mannual refers to.I think the problem is what you get after you use curl. please var_dump() it.post here if there is no response,I think you didn't configure curl right. hope this helps. /s