Guest User

Untitled

a guest
Nov 16th, 2018
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. $recharge_details = $this->session->userdata('data');
  2. $url = "http://api.rechapi.com/recharge.php?format=json&token=xy123r&mobile=$recharge_details['mobile']&amount=$recharge_details['mobile']&opid=$recharge_details['operator']&urid=$recharge_details['txnid']&opvalue1=#opvalue1&opvalue2=#opvalue2&opvalue3=#opvalue3";
  3.  
  4. $message ="your recharge successful";
  5. $message = urlencode($message);
  6.  
  7. $ch = curl_init();
  8.  
  9. if (!$ch) {
  10.  
  11. die("Couldn't initialize a cURL handle");
  12.  
  13. }
  14. $ret = curl_setopt($ch, CURLOPT_URL, $url);
  15.  
  16. // curl_setopt($ch, CURLOPT_POST, 1);
  17.  
  18. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  19.  
  20. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  21.  
  22. // curl_setopt($ch, CURLOPT_POSTFIELDS, "username=DEMOHYD&password=vizag@123&from=KALYNI&to=$mobile_numbers&msg=$message&type=1&dnd_check=0");
  23.  
  24. $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  25.  
  26. $curlresponse = curl_exec($ch); // execute
  27.  
  28. if (curl_errno($ch))
  29.  
  30. //echo 'curl error : ' . curl_error($ch);
  31.  
  32. if (empty($ret)) {
  33.  
  34. // some kind of an error happened
  35.  
  36. //die(curl_error($ch));
  37.  
  38. curl_close($ch); // close cURL handler
  39.  
  40. } else {
  41.  
  42. //$info = curl_getinfo($ch);
  43.  
  44. //print_r($info);
  45.  
  46. curl_close($ch); // close cURL handler
  47.  
  48. }
Add Comment
Please, Sign In to add comment