📅  最后修改于: 2022-03-11 14:46:18.853000             🧑  作者: Mango
import urllib # Python URL functions
import urllib2 # Python URL functions
authkey = "YourAuthKey" # Your authentication key.
mobiles = "9999999999" # Multiple mobiles numbers separated by comma.
message = "Test message" # Your message to send.
sender = "112233" # Sender ID,While using route4 sender id should be 6 characters long.
route = "default" # Define route
# Prepare you post parameters
values = {
'authkey' : authkey,
'mobiles' : mobiles,
'message' : message,
'sender' : sender,
'route' : route
}
url = "http://api.msg91.com/api/sendhttp.php" # API URL
postdata = urllib.urlencode(values) # URL encoding the data here.
req = urllib2.Request(url, postdata)
response = urllib2.urlopen(req)
output = response.read() # Get Response
print output # Print Response