Advertisement
fahmihilmansyah

pel

Nov 20th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 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 = "30";
  7. $trx_date = date("YmdHis");
  8. // $trx_type = "2200";
  9. $trx_type = "2100";
  10. $trx_id ="54000000021";
  11.  
  12. $hp = '08567896361';
  13. $account_no = '0817170820';
  14.  
  15. $nominal = 100;
  16. $signature = md5($username.$password.$product_id.$trx_date.$key);
  17. $post_data = array(
  18. 'trx_date' => $trx_date,
  19. 'trx_type' => $trx_type,
  20. 'trx_id' => $trx_id,
  21. 'cust_msisdn' => $hp,
  22. 'cust_account_no' => $account_no,
  23. 'product_id' => $product_id,
  24. 'product_nomination' => $nominal );
  25. $post_data = http_build_query($post_data,'', '&');
  26. $curl = curl_init($apiUrl);
  27. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  28. curl_setopt($curl, CURLOPT_POST, true);
  29. curl_setopt($curl, CURLOPT_URL, $apiUrl);
  30. curl_setopt($curl, CURLOPT_HEADER, 0);
  31. curl_setopt($curl, CURLOPT_HTTPHEADER, array(
  32. 'Authorization: '.'PELANGIREST username='.$username.'&password='.$password.'&signature='.$signature
  33. ));
  34. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  35. curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
  36. $response = curl_exec($curl);
  37. $info = curl_getinfo($curl);
  38. curl_close($curl);
  39. var_dump($curl);
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement