Не выходит что-то, выдает ошибку, Я ни разу не сталкивался с SOAP
Цитата |
Fatal error: Uncaught SoapFault exception: [HTTP] Unsupported Media Type in parsing.php:22 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://trackin...', '', 1, 0) #1 parsing.php(22): SoapClient->__call('getOperationHis...', Array) #2 parsing.php(22): SoapClient->getOperationHistory(Object(SoapParam)) #3 {main} thrown in parsing.php on line 22 |
<?php
// тут настройки.
$client = new SoapClient('https://tracking.russianpost.ru/rtm34?wsdl', array('trace' => 1, 'soap_version' => 'SOAP_1_2'));
$params = array (
'OperationHistoryRequest' => array(
'Barcode' => $barcode,
'MessageType' => '0',
'Language' => 'RUS'
),
'AuthorizationHeader' => array(
'login'=>$username,
'password'=>$password
),
);
$result = $client->getOperationHistory(new SoapParam($params,'OperationHistoryRequest'));
foreach ($result->OperationHistoryData->historyRecord as $record) {
printf(
"<p>%s </br> %s, %s</p>",
$record->OperationParameters->OperDate,
$record->AddressParameters->OperationAddress->Description,
$record->OperationParameters->OperAttr->Name
);
}