Help with Soapclient 1.2


Given the below soapclient - how can I a) check the version of tls that it is using, and b set it to 1.2 if it is not using that already?  I had assumed the browser I was using would control that side of things, but just want to double check!

$url = "https://www.SOMEURL/interface/api/report.asmx?wsdl";
//Create the client
$client = new SoapClient($url);
$datetimestamp = date("YmdHis");
$reportname = "report".$datetimestamp;

Open in new window

your help is very much appreciated!

James MurphyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The version of TLS should be automatically applied based on the version of OpenSSL (assuming that's the crypto library you're using) used when building PHP. However, you can set the stream context to tell it to force TLS 1.2:

$settings = array();
$settings['stream_context'] => stream_context_create(
  array('ssl' => array('crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT))
$client = new SoapClient($url, $settings);

Open in new window

Just be aware that if you DON'T have OpenSSL 1.0.1 or higher, it doesn't matter what code you use - the engine won't have the understanding of how to "speak" in TLS 1.2.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Oh, and to answer the other part of your question, there's not a very easy way to check which version is actually being used. Whenever I'm testing the SSL protocol being used, I install Wireshark on the client or server (whatever machine is initiating the connection), and then capture the connection attempt. The headers in the TCP packet will tell you the protocol being used.
James MurphyAuthor Commented:
Thank you! Your help is very much appreciated!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.