Convert PHP code to curl command where only TLSv1 is allowed -


How do I convert curl command to this php code? . I want to use this code on Linux machine executing a curl command

  $ header = array ("content type: text / xml", "content length:". Strlen ( $ Xml)); $ Ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, $ this- & gt; 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_xac ($ ch);  

I was tired of this one, but failed:

  curl -x post h "content type: text / xml" -o output. Txt -d "param1 = param1 & amp; username = username & password = password" can be https://site.url.com -d@ data.xml  

The problem is in HTTPS, because only

You will use it in PHP:

< P> curl_setopt ($ ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);

Documentation speaks of more TLS versions:

  • CURL_SSLVERSION_TLSv1_0
  • CURL_SSLVERSION_TLSv1_1
  • CURL_SSLVERSION_TLSv1_2

The TLS version only works with curl version 7.34 or newer.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -