Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. class retentional_api
  2. {
  3. public $APIKEY = 'f5de8340b4228cb411a2326f0c171b65'; // Your API key
  4. public function send($get=null, $post=null)
  5. {
  6. $ch = curl_init();
  7.  
  8. $url = 'http://retentionpanel.com/retentional_api.php';
  9.  
  10. if(!is_null($get) && $get!='')$url .= '?'.$get;
  11.  
  12. curl_setopt($ch, CURLOPT_URL, $url);
  13.  
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15.  
  16. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  17.  
  18. curl_setopt($ch, CURLOPT_TIMEOUT, 20);
  19.  
  20. curl_setopt($ch, CURLOPT_HEADER, false);
  21.  
  22. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  23.  
  24. curl_setopt($ch, CURLOPT_POST, true);
  25.  
  26. if(is_array($post))
  27.  
  28. {
  29. curl_setopt($ch, CURLOPT_POST, true);
  30.  
  31. curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  32. }
  33.  
  34. $result = curl_exec($ch);
  35.  
  36. if (curl_errno($ch) != 0 && empty($result)) $result = false;
  37.  
  38. curl_close($ch);
  39.  
  40. return $result;
  41. }
  42.  
  43. public function add_order($link, $serviceid, $quantity)
  44.  
  45. {
  46. return $this->send(null, array('apikey' => $this->APIKEY, 'action' =>'add',
  47.  
  48. 'serviceid' => $serviceid, 'url' => $link, 'qty' => $quantity ));
  49. }
  50.  
  51. public function get_order_status($order_id)
  52.  
  53. {
  54. return $this->send('apikey='.$this->APIKEY.'&order='.$order_id);
  55. }
  56.  
  57. }
  58.  
  59. $api = new retentional_api();
  60.  
  61. $order = $api->add_order('https://www.youtube.com/watch?v=5N07RsAdOxs','2','100');
  62.  
  63. $a =json_decode($order, true);
  64.  
  65. $orderid = $a['orderid'];
  66.  
  67. print "Order id: ".$orderid;
  68.  
  69. print "Massage: ".$a['msg'];
  70.  
  71. print "Order Status: ".$a['status'];
  72.  
  73. print "Order start_count: ".$a['start_count'];
  74.  
  75. print "Order amount: ".$a['amount'];
  76.  
  77. $api = new retentional_api();
  78.  
  79. $order_info = $api->get_order_status($orderid);
  80.  
  81. $order_info =json_decode($order_info, true);
  82.  
  83. echo "here is ur order status";
  84.  
  85. *******************
  86.  
  87. print "Order Status: ".$order_info['status'];
  88.  
  89. print "Order start_count: ".$order_info['start_count'];
  90.  
  91. print "Order amount: ".$order_info['amount'];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement