#!/usr/bin/env python # gSendSMS - Simple CLI for sending SMS through SMS gateway # (c) 2008 Jim Geovedi # # Note: the data transmitted over the Internet using the HTTP protocol is # not secure. This means other people can read your account name and password # you included in the above URL. To send data securely, you should use the # HTTPS protocol instead of HTTP # # Distributed under BSD license. from sys import argv, exit from urllib import urlencode, urlopen HOST = "127.0.0.1" PORT = "9000" USERNAME = "user" PASSWORD = "somethingsecret" PROTO = "http" # https def main(argv): if len(argv) < 4: print "Usage: %s " % argv[0] exit(1) msg = {} msg['username'] = USERNAME msg['password'] = PASSWORD msg['from'] = argv[1] msg['to'] = argv[1] msg['text'] = argv[3] data = urlencode(msg) url = PROTO + "://" + HOST + ":" + PORT + "/cgi-bin/sendsms?" + data response = urlopen(url) print response.read() if __name__ == "__main__": main(argv)