Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2.  
  3. $url = "http://192.168.20.9:8060/api/";
  4.  
  5. $post_string = '
  6. <?xml version="1.0" encoding="UTF-8" ?>
  7. <LoyaltyCardPersonalizeRequest>
  8. <CardCode>3592018089698</CardCode>
  9. <ClientName>Antoan Videnov</ClientName>
  10. <ClientAddress>София</ClientAddress>
  11. <ClientPhone>0886777074</ClientPhone>
  12. <ClientEMail>a_videnov@subra.bg</ClientEMail>
  13. </LoyaltyCardPersonalizeRequest>';
  14.  
  15. $header = "POST HTTP/1.0 \r\n";
  16. $header .= "Content-type: text/xml \r\n";
  17. $header .= "Content-length: ".strlen($post_string)." \r\n";
  18. $header .= "Content-transfer-encoding: text \r\n";
  19. $header .= "Connection: close \r\n\r\n";
  20. $header .= $post_string;
  21.  
  22. $ch = curl_init();
  23. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  24. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  25. curl_setopt($ch, CURLOPT_URL,$url);
  26. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  27. curl_setopt($ch, CURLOPT_TIMEOUT, 4);
  28. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
  29.  
  30. $data = curl_exec($ch);
  31.  
  32. if(curl_errno($ch))
  33. print curl_error($ch);
  34. else
  35. curl_close($ch);
  36.  
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement