Advertisement
vitvayti

Untitled

Sep 24th, 2019
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <?php
  2. $url = "https://85.236.4.226:543/NotifyOrderStatus.ashx";
  3. $cert_file = 'cert/client.crt';
  4. $key_file = 'cert/client.key';
  5. //$cert_password = 'nosecure';
  6. $data_string = '<?xml version="1.0" encoding="utf-8"?>
  7. <NotifyOrderStatusMessage xmlns="http://tempuri.org/XMLSchema.xsd">
  8. <Orders>
  9. <Order>
  10. <InternalOrderId>X100500</InternalOrderId>
  11. <StatusCode>40</StatusCode>
  12. <StatusDateTime>2013-01-01T12:30:00.0</StatusDateTime>
  13. </Order>
  14. <Order>
  15. <Order>
  16. <InternalOrderId>X100510</InternalOrderId>
  17. <StatusCode>20</StatusCode>
  18. <StatusDateTime>2013-01-01T12:30:00.0</StatusDateTime>
  19. <StatusReason>Клиент не отвечает на звонки курьера в течении 3 дней</StatusReason>
  20. </Order>
  21. </Orders>
  22. </NotifyOrderStatusMessage>';
  23.  
  24. $ch = curl_init();
  25.  
  26. $options = array(
  27. CURLOPT_RETURNTRANSFER => true,
  28. //CURLOPT_HEADER => true,
  29. CURLOPT_FOLLOWLOCATION => true,
  30. CURLOPT_SSL_VERIFYHOST => false,
  31. CURLOPT_SSL_VERIFYPEER => false,
  32. CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
  33. CURLOPT_VERBOSE => true,
  34. CURLOPT_URL => $url ,
  35. CURLOPT_POST => 1,
  36. CURLOPT_CUSTOMREQUEST => 'POST',
  37. CURLOPT_POSTFIELDS => $data_string,
  38. CURLOPT_HTTPHEADER => array('Content-type: application/xml', 'Content-length: '. strlen($data_string)),
  39. CURLOPT_HEADER => true,
  40. CURLOPT_SSLCERT => $cert_file ,
  41. //CURLOPT_SSLCERTPASSWD => $cert_password ,
  42. CURLOPT_SSLKEY => $key_file
  43. );
  44.  
  45. curl_setopt_array($ch, $options);
  46.  
  47. $output = curl_exec($ch);
  48.  
  49. if (!$output) {
  50. echo "Curl Error : " . curl_error($ch);
  51. } else {
  52. echo htmlentities($output);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement