vitvayti

ReturnClaim.ashx

Jun 1st, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.66 KB | None | 0 0
  1. $url = "https://85.236.4.226:543/ReturnClaim.ashx";
  2.  
  3. $cert_file = '/home/bitrix/ext_www/stage-01.multibonus.e-tiketka.com/api/cert/test/client.crt';
  4. $key_file = '/home/bitrix/ext_www/stage-01.multibonus.e-tiketka.com/api/cert/test/client.key';
  5. //$cert_password = 'nosecure';
  6.  
  7. $data_string = '<?xml version="1.0" encoding="UTF-8"?>
  8. <ReturnClaimMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  9. xsi:noNamespaceSchemaLocation="file:/Users/egors/Downloads/ReturnClaimMessage.xsd">
  10. <ReturnClaimId>987654321</ReturnClaimId>
  11. <OrderId>2985336</OrderId>
  12. <FullReturn>false</FullReturn>
  13. <RefundCost>100</RefundCost>
  14. </ReturnClaimMessage>';
  15.  
  16. //header("Content-type: text/xml; charset=utf-8");
  17. //echo $data_string;
  18. //die();
  19.  
  20. $ch = curl_init();
  21.  
  22. $options = array(
  23.     CURLOPT_RETURNTRANSFER => true,
  24.     //CURLOPT_HEADER => true,
  25.     CURLOPT_FOLLOWLOCATION => true,
  26.     CURLOPT_SSL_VERIFYHOST => false,
  27.     CURLOPT_SSL_VERIFYPEER => false,
  28.     CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
  29.     CURLOPT_VERBOSE => true,
  30.     CURLOPT_URL => $url ,
  31.     CURLOPT_POST => 1,
  32.     CURLOPT_CUSTOMREQUEST => 'POST',
  33.     CURLOPT_POSTFIELDS => $data_string,
  34.     CURLOPT_HTTPHEADER => array('Content-type: application/xml', 'Content-length: '. strlen($data_string)),
  35.     CURLOPT_HEADER => true,
  36.     CURLOPT_SSLCERT => $cert_file ,
  37.     //CURLOPT_SSLCERTPASSWD => $cert_password ,
  38.     CURLOPT_SSLKEY => $key_file
  39. );
  40.  
  41. curl_setopt_array($ch, $options);
  42.  
  43. $output = curl_exec($ch);
  44.  
  45. if (!$output) {
  46.     echo "Curl Error : " . curl_error($ch);
  47. } else {
  48.     echo htmlentities($output);
  49. }
Add Comment
Please, Sign In to add comment