From 5b3482d264f85268cc55a7e5fe23d72a606ffc59 Mon Sep 17 00:00:00 2001 From: proxy-m Date: Tue, 30 Aug 2022 12:21:58 +0300 Subject: [PATCH 1/5] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ce6537e..d9a8e4c 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,13 @@ NuSOAP is a rewrite of SOAPx4, provided by NuSphere and Dietrich Ayala. It is a ## Info -- Supported PHP: [5.4 - 8.1](https://travis-ci.org/pwnlabs/nusoap) -- Latest version: [0.9.11](https://github.com/pwnlabs/nusoap/releases/tag/v0.9.11) -- Dev version: [develop](https://github.com/pwnlabs/nusoap/tree/develop) +- [Supported PHP: 7.3 - 8.1](https://travis-ci.org/pwnlabs/nusoap) +- [Latest release: 0.9.11](https://github.com/pwnlabs/nusoap/releases/tag/v0.9.11) +- [Dev version: develop](https://github.com/pwnlabs/nusoap/tree/develop) - Official project: https://sourceforge.net/projects/nusoap/ +- [smevx-crypto for Java 8](https://github.com/proxy-m/smevx-crypto) +- [openssl error: Algorithm gost2012_256 not found](https://forum.rutoken.ru/topic/3173/) +- [openssl gost2012_256, hmac-gost-3411-12-256](https://docs.altlinux.org/ru-RU/alt-workstation/10.1/html-single/alt-workstation/index.html#idm45860460701600) ## Installation From a979509b2600ad03f2a53d6aceee289ec07f576c Mon Sep 17 00:00:00 2001 From: proxy-m Date: Tue, 30 Aug 2022 15:03:15 +0300 Subject: [PATCH 2/5] $authtype (basic|bearer|digest|certificate|ntlm) --- src/nusoap.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nusoap.php b/src/nusoap.php index 7d0697b..f789fff 100755 --- a/src/nusoap.php +++ b/src/nusoap.php @@ -2692,7 +2692,7 @@ function sendHTTPS($data, $timeout = 0, $response_timeout = 30, $cookies = NULL) * * @param string $username * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) + * @param string $authtype (basic|bearer|digest|certificate|ntlm) * @param array $digestRequest (keys must be nonce, nc, realm, qop) * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) * @access public @@ -2706,6 +2706,8 @@ function setCredentials($username, $password, $authtype = 'basic', $digestReques // cf. RFC 2617 if ($authtype == 'basic') { $this->setHeader('Authorization', 'Basic ' . base64_encode(str_replace(':', '', $username) . ':' . $password)); + } elseif ($authtype == 'bearer') { + $this->setHeader('Authorization', 'Bearer ' . (isset($password) ? $password : $username)); } elseif ($authtype == 'digest') { if (isset($digestRequest['nonce'])) { $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; @@ -3001,7 +3003,7 @@ function sendRequest($data, $cookies = null) //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); $curl_headers = array(); foreach ($this->outgoing_headers as $k => $v) { - if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { + if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || /*$k == 'Authorization' ||*/ $k == 'Proxy-Authorization') { $this->debug("Skip cURL header $k: $v"); } else { $curl_headers[] = "$k: $v"; From 8559f4c6f1fef9f395099b4103b2c46fbbfd56e6 Mon Sep 17 00:00:00 2001 From: proxy-m Date: Tue, 30 Aug 2022 15:08:48 +0300 Subject: [PATCH 3/5] client4yandex --- samples/client4yandex.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 samples/client4yandex.php diff --git a/samples/client4yandex.php b/samples/client4yandex.php new file mode 100644 index 0000000..059c96d --- /dev/null +++ b/samples/client4yandex.php @@ -0,0 +1,30 @@ +authtype = 'bearer'; /// 'basic'; +$client->decode_utf8 = 0; +$client->soap_defencoding = 'UTF-8'; + +// Формирование заголовков SOAP-запроса +$client->setCredentials('token', $token, 'bearer'); ///$client->setHeaders("$token\n $locale"); + +// Выполнение запроса к серверу API Директа +$result = $client->call(/*'GetClientInfo'*/'get', array('SelectionCriteria' => (object) array(), 'FieldNames' => array('Id', 'Name'))); + +// Вывод запроса и ответа +echo "Запрос:
".htmlspecialchars($client->request, ENT_QUOTES)."
"; +echo "Ответ:
".htmlspecialchars($client->response, ENT_QUOTES)."
"; + + +// Вывод отладочной информации +echo '
'.htmlspecialchars($client->debug_str, ENT_QUOTES).'
'; + +?> From e9029626879d459fa0b888e6db6f9b24753d8c18 Mon Sep 17 00:00:00 2001 From: proxy-m Date: Wed, 14 Sep 2022 14:38:56 +0300 Subject: [PATCH 4/5] Update nusoap.php --- src/nusoap.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nusoap.php b/src/nusoap.php index f789fff..f0f0462 100755 --- a/src/nusoap.php +++ b/src/nusoap.php @@ -2546,8 +2546,14 @@ function connect($connection_timeout = 0, $response_timeout = 30) $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout); } - if ($this->scheme == 'https') { + if ($this->scheme == 'https') { + $this->setCurlOption(CURLOPT_SSLENGINE, 'gost'); + $this->setCurlOption(CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1); // TLSv1.1 and more (TLSv1.1, TLSv1.2, TLSv1.3) + ///$this->setCurlOption(CURLOPT_SSL_CIPHER_LIST, 'TLSv1,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA'); + ///$this->setCurlOption(CURLOPT_TLS13_CIPHERS, 'GOST2012-GOST8912-GOST8912:GOST2001-GOST89-GOST89:DES-CBC3-SHA:IDEA-CBC-MD5:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDH-RSA-AES256-GCM-SHA384:ECDH-ECDSA-AES256-GCM-SHA384:AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:ECDH-RSA-AES128-GCM-SHA256:ECDH-ECDSA-AES128-GCM-SHA256:AES128-GCM-SHA256:TLS_AES_256_GCM_SHA384'); ///// $this->debug('set cURL SSL verify options'); + ///$this->setCurlOption(CURLOPT_SSLCERTTYPE, 'CERT_SHA1_HASH_PROP_ID:CERT_SYSTEM_STORE_CURRENT_USER:MY'); + ///$this->setCurlOption(CURLOPT_SSLCERT, '53be6850031bf03bff056fd5215a46c07b2248d6'); // recent versions of cURL turn on peer/host checking by default, // while PHP binaries are not compiled with a default location for the // CA cert bundle, so disable peer/host checking. @@ -3003,7 +3009,7 @@ function sendRequest($data, $cookies = null) //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); $curl_headers = array(); foreach ($this->outgoing_headers as $k => $v) { - if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || /*$k == 'Authorization' ||*/ $k == 'Proxy-Authorization') { + if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || /*$k == 'Authorization' ||*/ $k == 'Proxy-Authorization') { $this->debug("Skip cURL header $k: $v"); } else { $curl_headers[] = "$k: $v"; From 955769bd5941b7aacae781394775f7e5201ba063 Mon Sep 17 00:00:00 2001 From: proxy-m Date: Tue, 6 Dec 2022 22:42:52 +0300 Subject: [PATCH 5/5] English example --- samples/client4yandex.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/samples/client4yandex.php b/samples/client4yandex.php index 059c96d..a9ad324 100644 --- a/samples/client4yandex.php +++ b/samples/client4yandex.php @@ -3,28 +3,28 @@ $wsdlurl = 'https://api-sandbox.direct.yandex.com/v5/campaigns?wsdl'; /// 'https://api-sandbox.direct.yandex.ru/live/v4/wsdl/'; $token = 'YOUR TOKEN'; -$locale = 'ru'; +$locale = 'en'; -// Инициализация NuSOAP-клиента +// Initialization of NuSOAP-client $client = new nusoap_client($wsdlurl, 'wsdl'); -# Параметры NuSOAP-клиента +# Parameters of NuSOAP-client $client->authtype = 'bearer'; /// 'basic'; $client->decode_utf8 = 0; $client->soap_defencoding = 'UTF-8'; -// Формирование заголовков SOAP-запроса +// Adding headers for SOAP-request $client->setCredentials('token', $token, 'bearer'); ///$client->setHeaders("$token\n $locale"); -// Выполнение запроса к серверу API Директа +// Call request to server (API Yandex Direct) $result = $client->call(/*'GetClientInfo'*/'get', array('SelectionCriteria' => (object) array(), 'FieldNames' => array('Id', 'Name'))); -// Вывод запроса и ответа -echo "Запрос:
".htmlspecialchars($client->request, ENT_QUOTES)."
"; -echo "Ответ:
".htmlspecialchars($client->response, ENT_QUOTES)."
"; +// Output of request and response +echo "Request (to server):
".htmlspecialchars($client->request, ENT_QUOTES)."
"; +echo "Response (from server):
".htmlspecialchars($client->response, ENT_QUOTES)."
"; -// Вывод отладочной информации +// Output of debug info echo '
'.htmlspecialchars($client->debug_str, ENT_QUOTES).'
'; ?>