Advertisement
fahmihilmansyah

pel

Nov 23rd, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. <?php
  2. $apiUrl= "http://103.16.138.19:8000/Transactions/trx.xml";
  3. $username = "tns14110001";
  4. $password = "1234";
  5. $key= "k6a4qeer1piwqfc";
  6. $product_id = "18";
  7. $trx_date = date("YmdHis");
  8. $trx_type = "2200";
  9. // $trx_type = "2100";
  10. $trx_id =time();
  11.  
  12. $hp = '08567896361';
  13. $account_no = '0';
  14.  
  15. // $nominal = "1800";
  16. $nominal = "0";
  17. $signature = md5($username.$password.$product_id.$trx_date.$key);
  18. $post_data = array(
  19. 'trx_date' => $trx_date,
  20. 'trx_type' => $trx_type,
  21. 'trx_id' => $trx_id,
  22. 'cust_msisdn' => $hp,
  23. 'cust_account_no' => $account_no,
  24. 'product_id' => $product_id,
  25. 'product_nomination' => $nominal );
  26. $post_data = http_build_query($post_data,'', '&');
  27. $curl = curl_init($apiUrl);
  28. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  29. curl_setopt($curl, CURLOPT_POST, true);
  30. curl_setopt($curl, CURLOPT_URL, $apiUrl);
  31. curl_setopt($curl, CURLOPT_HEADER, 0);
  32. curl_setopt($curl, CURLOPT_HTTPHEADER, array(
  33. 'Authorization: '.'PELANGIREST username='.$username.'&password='.$password.'&signature='.$signature
  34. ));
  35. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  36. curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
  37. $response = curl_exec($curl);
  38. $info = curl_getinfo($curl);
  39. curl_close($curl);
  40. echo ($response);
  41.  
  42. $xml=json_decode(json_encode(simplexml_load_string($response)), true) ;
  43. echo "<br>".$xml['data']['trx']['rc'];
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement