Username: Password:

Forgot password? Sign up


Sign up

Receive 5 free credits.
Easy to try, simple to use.


register

Test Network

+


Python code sample

Simplest case - sending a single message, with no error checking:

import urllib

# If your firewall blocks access to port 5567, you can fall back to port 80:
# url = "http://bulksms.2way.co.za/eapi/submission/send_sms/2/2.0"
# (See FAQ for more details.)
url = "http://bulksms.2way.co.za:5567/eapi/submission/send_sms/2/2.0"
params = urllib.urlencode({'username' : 'myusername', 'password' : 'xxxxxxxx', 'message' : 'Testing Python', 'msisdn' : 271231231234})
f = urllib.urlopen(url, params)
# Read from the object, storing the page's contents in 's'.
s = f.read()
# Print the contents
#print s

result = s.split('|')
statusCode = result[0]
statusString = result[1]
if statusCode != '0':
        print "Error: " + statusCode + ": " + statusString
else:
        print "Message sent: batch ID " + result[2]

f.close()