PHP SOAP Communication Using TLS 1.2

你离开我真会死。 提交于 2019-12-04 12:28:38

问题


We have integrated UPS Web Service in our site. recently we got alert from UPS :

Effective January 26, 2016,the UPS test environment will require the TLS 1.2 security protocol, and willbe available for your system testing.

Effective May 31, 2016,UPS will require the TLS 1.2 security protocol in production. After that date,any communication requests submitted to UPS using older protocols (TLS 1.1 orearlier) will fail.

My question is :

Is there any way to communicate PHP SOAP using TLS ? i have already googled a lot but could not find any solution yet.

Please suggest


回答1:


I met this problem too. I use this to force TLS communication.

$mode = array
(
    'soap_version' => 'SOAP_1_1',  // use soap 1.1 client
    'trace' => 1,
    'stream_context' => stream_context_create(array(
        'ssl' => array(
            'crypto_method' =>  STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
        )
     ))
);

// initialize soap client
$client = new SoapClient($this->wsdl, $mode);

But I have always a problem (on my dev environment) with MAMP witch includes a version of openssl without TLS 1.2 support.




回答2:


Finally i got solution for this issue.It require OpenSSL > 1.0.1 or NSS > 3.15 and in my case our server support SSL Version is NSS/3.19.1 Basic ECC so no need to change any code.



来源:https://stackoverflow.com/questions/35887414/php-soap-communication-using-tls-1-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!