daily pastebin goal
82%
SHARE
TWEET

Untitled

zainilabdin Feb 13th, 2018 66 in 175 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $curl = curl_init();
  3.  
  4. curl_setopt_array($curl, array(
  5.     CURLOPT_URL => "https://api.kcell.kz/app/smsgw/rest/v2/messages",
  6.     CURLOPT_RETURNTRANSFER => true,
  7.     CURLOPT_ENCODING => "",
  8.     CURLOPT_MAXREDIRS => 10,
  9.     CURLOPT_TIMEOUT => 30,
  10.     CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  11.     CURLOPT_CUSTOMREQUEST => "POST",
  12.     CURLOPT_USERPWD=>'europharma_rest:euroPh%^&!',
  13.     CURLOPT_POSTFIELDS =>"{
  14.        \r\n\"client_message_id\"\t : \"euro_".generateRandomInt(9)."\",
  15.        \r\n\"sender\"\t\t\t        : \"EUROPHARMA\",
  16.        \r\n\"recipient\"\t\t       : \"77786679794\",
  17.        \r\n\"time_bounds\"         : \"ad99\",
  18.        \r\n\"message_text\"\t\t    : \"hello\"\r\n
  19.    }",
  20.     CURLOPT_HTTPHEADER => array(
  21.         "accept: application/json, text/plain, */*",
  22.         "cache-control: no-cache",
  23.         "content-type: application/json;charset=utf-8"
  24.     ),
  25. ));
  26.  
  27. function generateRandomInt($length = 10){
  28.     return substr(str_shuffle(str_repeat($x = '0123456789', ceil($length / strlen($x)))), 1, $length);
  29. }
  30.  
  31. $response = curl_exec($curl);
  32. $err = curl_error($curl);
  33.  
  34. curl_close($curl);
  35.  
  36. if ($err) {
  37.     echo "cURL Error #:" . $err;
  38. } else {
  39.     echo $response;
  40. }
RAW Paste Data
Top