Developer Tools
BasicText SMSCampaignOTPVirtual NumberResellerSample CodePhonebookError Code
HOME LOGIN SIGN UP
  • OTP Message
  • Verify OTP
  • Resend OTP
  • Sample Code
    • » PHP
    • » Python

PHP Sample Code Send SMS

Code:

import urllib # Python URL functions
import urllib2 # Python URL functions
def sendRequest(url,pastData) postdata = urllib.urlencode(pastData) # URL encoding the data here. req = urllib2.Request(url, postdata) response = urllib2.urlopen(req) output = response.read() # Get Response return output
//For sending OTP Message url = "http://world.msg91.com/api/otp.php"; pastData = {
'authkey' : 'YourAuthKey',
'mobile' : '9999999999',
'message' : 'Test message',
'sender' : '112233',
'otp' : 'yourOTP'
}
sendRequest(url,pastData)
// For Verify otp url = "http://world.msg91.com/api/verifyRequestOTP.php"; pastData = {
'authkey' : 'YourAuthKey',
'mobile' : '9999999999',
'otp' : 'yourOTP'
}
sendRequest(url,pastData)
// For Retry otp url = "http://world.msg91.com/api/retryotp.php"; pastData = {
'authkey' : 'YourAuthKey',
'mobile' : '9999999999',
'retrytype' : 'text/voice'
}
sendRequest(url,pastData)

© 2008-2025 | All Rights Reserved.