$SendPart = [
'items' =>
[
'article' => "290775П29",
'brand' => "ГАЗ",
'SupplierName' => "Ростов-на-Дону",
'CostSale' => "14.04",
'Quantity' => 1,
'SupplierTimeMin' => 0,
'SupplierTimeMax' => 0,
'Comment' => "",
'GioID' => 77068
]
];
$SendUri= json_encode($SendPart);
$data = AddOrder($SendUri);
$SendPart = [
[
'article' => "290775П29",
'brand' => "ГАЗ",
'SupplierName' => "Ростов-на-Дону",
'CostSale' => "14.04",
'Quantity' => 1,
'SupplierTimeMin' => 0,
'SupplierTimeMax' => 0,
'Comment' => "",
'GioID' => 77068
]
];
$SendUri= json_encode($SendPart);
$data = AddOrder($SendUri);
/SearchService/AddOrder?items=%5B%7B%22article%22%3A%22290775%5Cu041f29%22%2C%22brand%22%3A%22%5Cu0413%5Cu0410%5Cu0417%22%2C%22SupplierName%22%3A%22%5Cu0420%5Cu043e%5Cu0441%5Cu0442%5Cu043e%5Cu0432-%5Cu043d%5Cu0430-%5Cu0414%5Cu043e%5Cu043d%5Cu0443%22%2C%22CostSale%22%3A14.04%2C%22Quantity%22%3A%221%22%2C%22SupplierTimeMin%22%3A0%2C%22SupplierTimeMax%22%3A0%2C%22Comment%22%3A%22%22%2C%22GioID%22%3A%2277068%22%7D%5D
В переменной $Part необходимые данные валидные
$SendPart[0]['article']= $Part['WebService_Data']['Article'];
$SendPart[0]['brand']= $Part['WebService_Data']['brand'];
$SendPart[0]['suppliername']= $Part['WebService_Data']['SupplierName'];
$SendPart[0]['costsale']= $Part['WebService_Data']['CostSale'];
$SendPart[0]['suppliertimemin']= $Part['WebService_Data']['supplierTimeMin'];
$SendPart[0]['suppliertimemax']= $Part['WebService_Data']['supplierTimeMax'];
$SendPart[0]['quantity']= (int)$Part['count'];
$SendPart[0]['comment']=$Comment;
$SendPart[0]['gioid']= (int)$Part['parts_id'];
$SendUri=json_encode($SendPart);
$data = $PrtAS->AddOrder($SendUri);
public function AddOrder($SendUri) {
$url = $this->url.'/SearchService/AddOrder?items='.urlencode($SendUri).'';
$auth = base64_encode($this->login.":".$this->pass);
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
"http"=>array(
"header"=>"Authorization: Basic $auth",
'ignore_errors' => true,
),
);
try {
$result = file_get_contents($url,false, stream_context_create($arrContextOptions));
if($result==false){
throw new Exception('Error');
} else {
//$result=json_decode($result, true);
}
}catch (Exception $e) {
$result['Error']="file_get_contents Error";
}
echo $url;
return $result;
}
$SendPart[0]['article']= $Part['WebService_Data']['Article'];
$SendPart[0]['brand']= $Part['WebService_Data']['brand'];
$SendPart[0]['supplierName']= $Part['WebService_Data']['SupplierName'];
$SendPart[0]['costSale']= $Part['WebService_Data']['CostSale'];
$SendPart[0]['supplierTimeMin']= (int)$Part['WebService_Data']['supplierTimeMin'];
$SendPart[0]['supplierTimeMax']= (int)$Part['WebService_Data']['supplierTimeMax'];
$SendPart[0]['quantity']= (int)$Part['count'];
$SendPart[0]['comment']=$Comment;
$SendPart[0]['GioID']= (int)$Part['parts_id'];
$items =json_encode($SendPart);