Last active
March 28, 2023 02:27
-
-
Save kavehbc/3f8bccf50aba6a9ed5259dac94286c80 to your computer and use it in GitHub Desktop.
Python - Send SMS via MobileVoIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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