Skip to content

Instantly share code, notes, and snippets.

@kavehbc
Last active March 28, 2023 02:27
Show Gist options
  • Save kavehbc/3f8bccf50aba6a9ed5259dac94286c80 to your computer and use it in GitHub Desktop.
Save kavehbc/3f8bccf50aba6a9ed5259dac94286c80 to your computer and use it in GitHub Desktop.
Python - Send SMS via MobileVoIP
import urllib
import urllib.parse
import xmltodict
import requests
def send_sms(to_phone, message):
voip_server = "voipmove.com" # or any other Dellmont servers (find them on MobileVoip.com)
my_username = "my_username"
my_password = "my_password"
from_phone = "from_phone_number" # if a caller ID is already set
message = urllib.parse.quote(message)
url = f"https://www.{voip_server}/myaccount/sendsms.php?username={my_username}&password={my_password}&from={from_phone}&to={to_phone}&text={message}"
obj = requests.get(url)
data = obj.content.decode('utf-8')
data = xmltodict.parse(data)
if data['SmsResponse']['resultstring'] == 'success':
return True
else:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment