Advertisement
vitvayti

Untitled

Sep 19th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. $resArray = [
  2. 'Orders' => [
  3. 'key' => 'Order',
  4. 'items' => [
  5. [
  6. 'InternalOrderId' => '2976421',
  7. 'StatusCode' => 30,
  8. 'StatusDateTime' => date("Y-m-d H:i:s")
  9. ]
  10. ]
  11. ]
  12. ];
  13.  
  14. $node = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><NotifyOrderStatusMessage xmlns="http://tempuri.org/XMLSchema.xsd"/>');
  15. $node = CustomArrayToXml::ArrayToXml($resArray, $node);
  16. $xml = $node->asXML();
  17.  
  18. //header("Content-type: text/xml; charset=utf-8");
  19. //echo $xml;
  20. //die();
  21.  
  22. $url = 'https://85.236.4.226:543/NotifyOrderStatus.ashx';
  23. $curl = curl_init($url);
  24.  
  25. curl_setopt($curl, CURLOPT_HTTPHEADER, array("ConteCURLOPT_SSL_VERIFYPEERnt-Type: text/xml"));
  26. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  27. curl_setopt($curl, CURLOPT_POST, true);
  28. curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
  29. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  30. curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
  31. curl_setopt($curl, CURLOPT_TIMEOUT, 10);
  32. $result = curl_exec($curl);
  33. if (curl_errno($curl)) {
  34. throw new Exception(curl_error($curl));
  35. }
  36. curl_close($curl);
  37. echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement