Convert PHP code to curl command where only TLSv1 is allowed -
Convert PHP code to curl command where only TLSv1 is allowed -
how can convert php code curl command? want utilize code on linux machine executing single curl command.
$headers = array( "content-type: text/xml", "content-length: " . strlen($xml) ); $ch = curl_init(); curl_setopt($ch, curlopt_url, $this->url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_timeout, 10000); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $xml); curl_setopt($ch, curlopt_httpheader, $headers); $data = curl_exec($ch); i tired one, unsuccessful:
curl -x post -h "content-type: text/xml" -o output.txt -d "param1=param1&username=username&password=password" https://site.url.com -d @data.xml maybe problem in https because tlsv1 allowed on site.
in php use:
curl_setopt($ch, curlopt_sslversion, curl_sslversion_tlsv1_1);
documentation speaks of more tls versions:
http://www.php.net/manual/en/function.curl-setopt.php
curl_sslversion_tlsv1_0 curl_sslversion_tlsv1_1 curl_sslversion_tlsv1_2the tls versions work curl version 7.34 or newer.
php curl
Comments
Post a Comment