Due to vulnerabilities such as "OpenSSL Heartbleed" and "SSLv3 man-in-the-middle attack", many platforms have disabled SSLv2 and SSLv3 support, some clients that use SSLv2, SSLv3, or earlier versions are not supported, such as the WeChat public platform.
If cURL is used to operate https URLs, the following options are provided:
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false );
Curl_setopt ($ ch, CURLOPT_SSLVERSION, 1 );
Example
PHP CURL HTTPS POST
Function vpost ($ url, $ data) {// simulate the data submission function
$ Curl = curl_init (); // Start a CURL session
Curl_setopt ($ curl, CURLOPT_URL, $ url); // address to be accessed
Curl_setopt ($ curl, CURLOPT_SSL_VERIFYPEER, 0); // Check the certificate source
Curl_setopt ($ curl, CURLOPT_SSL_VERIFYHOST, 1); // check whether the SSL encryption algorithm exists from the certificate
Curl_setopt ($ curl, CURLOPT_USERAGENT, $ _ SERVER ['http _ USER_AGENT ']); // simulate the browser used by the user
Curl_setopt ($ curl, CURLOPT_FOLLOWLOCATION, 1); // use automatic redirect
Curl_setopt ($ curl, CURLOPT_AUTOREFERER, 1); // automatically sets Referer
Curl_setopt ($ curl, CURLOPT_POST, 1); // send a regular Post request
Curl_setopt ($ curl, CURLOPT_POSTFIELDS, $ data); // data packet submitted by Post
Curl_setopt ($ curl, CURLOPT_TIMEOUT, 30); // sets the timeout limit to prevent endless loops.
Curl_setopt ($ curl, CURLOPT_HEADER, 0); // display the returned Header content.
Curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1); // The obtained information is returned as a file stream.
$ TmpInfo = curl_exec ($ curl); // perform the operation
If (curl_errno ($ curl )){
Echo 'errno'. curl_error ($ curl); // catch an exception
}
Curl_close ($ curl); // Close the CURL session
Return $ tmpInfo; // return data
}
$ Url = "https://xxx.xxx.xxx/xxx ";
$ Data = "x = xxxxxx ";
$ Result = vpost ($ url, $ data );