Docy

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.echosofts.com/api/sendsms.php?'
                                            + urllib.parse.urlencode(params))
                                        return (f.read(), f.code)
                                    
                                    resp, code = sendSMS('apikey', '923186373741,923186373741,923186373741',
                                        '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.echosofts.com/api/sendsms.php?")
                                        f = urllib.request.urlopen(request, data)
                                        fr = f.read()
                                        return(fr)
                                    
                                    resp =  sendSMS('apikey', '923186373741,923186373741,923186373741',
                                        'SmartSMS', 'This is your message')
                                    print (resp)
                                    
                                    
                                         
                                    
CONTENTS