Advertisement
AceScottie

send text

Sep 25th, 2018
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. import requests
  2. url = 'http://api.textmarketer.co.uk/services/rest/sms'
  3.         orig = "Test"
  4.         values = {'username'    :   'user',
  5.                 'password'      :   'passwd',
  6.                 'option'        :   'xml',
  7.                 'to'            :   number,
  8.                 'message'       :   'My test message',             
  9.                 'orig'          :   'Test'
  10.                 }
  11.         r = requests.post(url, data=values)
  12.         print(r.text)
  13. #####------------end of python code
  14. <?php
  15. public function send($message,$mobile,$originator)
  16.     {
  17.         $url_array= array('message'=>$message,'mobile_number'=>$mobile, 'originator'=>$originator,
  18.         'username'=>$this->username, 'password'=>$this->password);
  19.         $url_string = $data = http_build_query($url_array, '', '&');
  20.         // we're using the curl library to make the request
  21.        $curlHandle = curl_init();
  22.        curl_setopt($curlHandle, CURLOPT_URL, $this->url);
  23.        curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
  24.        curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $url_string);
  25.        curl_setopt($curlHandle, CURLOPT_POST, 1);
  26.        $responseBody = curl_exec($curlHandle);
  27.        $responseInfo  = curl_getinfo($curlHandle);
  28.        curl_close($curlHandle);
  29.        echo $this->handleResponse($responseBody,$responseInfo);
  30.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement