Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- url = 'http://api.textmarketer.co.uk/services/rest/sms'
- orig = "Test"
- values = {'username' : 'user',
- 'password' : 'passwd',
- 'option' : 'xml',
- 'to' : number,
- 'message' : 'My test message',
- 'orig' : 'Test'
- }
- r = requests.post(url, data=values)
- print(r.text)
- #####------------end of python code
- <?php
- public function send($message,$mobile,$originator)
- {
- $url_array= array('message'=>$message,'mobile_number'=>$mobile, 'originator'=>$originator,
- 'username'=>$this->username, 'password'=>$this->password);
- $url_string = $data = http_build_query($url_array, '', '&');
- // we're using the curl library to make the request
- $curlHandle = curl_init();
- curl_setopt($curlHandle, CURLOPT_URL, $this->url);
- curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $url_string);
- curl_setopt($curlHandle, CURLOPT_POST, 1);
- $responseBody = curl_exec($curlHandle);
- $responseInfo = curl_getinfo($curlHandle);
- curl_close($curlHandle);
- echo $this->handleResponse($responseBody,$responseInfo);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement