APIDoc

Did You Know?

Python Sample Code (GET)

                                        

#!/usr/bin/env python

import urllib.request
import urllib.parse

def sendSMS(apikey, phone, sender, message):
    params = {'apikey': yourapiKey, 'phone': phone, 'message' : message, 'sender': sender}
    f = urllib.request.urlopen('http://www.hajanaone.com/api/sendsms.php?'
        + urllib.parse.urlencode(params))
    return (f.read(), f.code)

resp, code = sendSMS('apikey', '923331234567,923451234567,923001234567',
    'SmartSMS', 'Test with an ampersand (&) and a £5 note')
print (resp)


                                    

Python Sample Code (POST)

                                        
                                       

#!/usr/bin/env python

import urllib.request
import urllib.parse

def sendSMS(apikey, phone, sender, message):
    data =  urllib.parse.urlencode({'apikey': apikey, 'phone': phone,
        'message' : message, 'sender': sender})
    data = data.encode('utf-8')
    request = urllib.request.Request("http://www.hajanaone.com/api/sendsms.php?")
    f = urllib.request.urlopen(request, data)
    fr = f.read()
    return(fr)

resp =  sendSMS('apikey', '923331234567,923451234567,923001234567',
    'SmartSMS', 'This is your message')
print (resp)