Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $resArray = [
- 'Orders' => [
- 'key' => 'Order',
- 'items' => [
- [
- 'InternalOrderId' => '2976421',
- 'StatusCode' => 30,
- 'StatusDateTime' => date("Y-m-d H:i:s")
- ]
- ]
- ]
- ];
- $node = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><NotifyOrderStatusMessage xmlns="http://tempuri.org/XMLSchema.xsd"/>');
- $node = CustomArrayToXml::ArrayToXml($resArray, $node);
- $xml = $node->asXML();
- //header("Content-type: text/xml; charset=utf-8");
- //echo $xml;
- //die();
- $url = 'https://85.236.4.226:543/NotifyOrderStatus.ashx';
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_HTTPHEADER, array("ConteCURLOPT_SSL_VERIFYPEERnt-Type: text/xml"));
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_POST, true);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($curl, CURLOPT_TIMEOUT, 10);
- $result = curl_exec($curl);
- if (curl_errno($curl)) {
- throw new Exception(curl_error($curl));
- }
- curl_close($curl);
- echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement