- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $ssl_url);
- curl_setopt($curl, CURLOPT_POST, 1);
-
- curl_setopt($curl, CURLOPT_SSLCERT, realpath("cert.pem"));//证书
- curl_setopt($curl, CURLOPT_SSLCERTPASSWD,'');
- curl_setopt($curl, CURLOPT_SSLKEY,realpath("key.pem"));//私钥
- curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $pass);
-
- //curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,2);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($curl, CURLOPTL_HTTPAUTH, CURLAUTH_BASIC);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $msg);
- $data = curl_exec($curl);
- echo "error: ".curl_error($curl)."<br>";
- echo "errno: ".curl_errno($curl);
- curl_close($curl);
- //var_dump($data);
- echo "<br>return curl data: ".$data;