PHP code example of traffaret / amphp-async-soap
1. Go to this page and download the library: Download traffaret/amphp-async-soap library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
traffaret / amphp-async-soap example snippets
use Amp\Http\Client\HttpClientBuilder;
use Traff\Soap\Options;
use Traff\Soap\SoapTransportBuilder;
use Traff\Soap\Wsdl\WsdlUrlFactory;
$http_client = HttpClientBuilder::buildDefault();
$options = (new Options())
->withSoapVersion(\SOAP_1_1)
->withConnectionTimeout(20);
$wsdl = yield (new WsdlUrlFactory())
->createWsdl('https://cbr.ru/DailyInfoWebServ/DailyInfo.asmx?WSDL', null, $http_client)
->toString();
$soap_transport = (new SoapTransportBuilder())
->withHttpClient($http_client)
->withWsdl($wsdl)
->withOptions($options)
->build();
$result = yield $soap_transport->callAsync('GetCursOnDate', [['On_date' => (new \DateTime('now'))->format('Y-m-d')]]);
// Or
$result = yield $soap_transport->GetCursOnDate(['On_date' => (new \DateTime('now'))->format('Y-m-d')]);