胜达短信平台公司

主页 > 短信接口 > 代码示范 > PYTHON

[切换]

选择短信群发地区 :北京上海广州深圳
 
         PYTHON:


#!/usr/local/bin/python
#-*- coding:utf-8 -*-
import httplib
import urllib
 
host  = "duanxin66.com"
sms_send_uri = "/utf8/sms.aspx"
 
#用户名是登录duanxin66.com账号名
account  = "用户名"
#接口密码
password = "接口密码"
 
def send_sms(text, mobile):
    params = urllib.urlencode({'account': account, 'password' : password, 'content': text, 'mobile':mobile,'format':'json' })
    headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
    conn = httplib.HTTPConnection(host, port=80, timeout=30)
    conn.request("POST", sms_send_uri, params, headers)
    response = conn.getresponse()
    response_str = response.read()
    conn.close()
    return response_str
 
if __name__ == '__main__':
 
    mobile = "158xxxxxxxx"
    text = "您的订单编码:4557。如需帮助请联系客服。"
 
    print(send_sms(text, mobile))
胜达短信群发首页
微信二维码扫一扫
微信联系我们
短信群发网 联系QQ:2321952682 邮箱236815253@qq.com Copyright © 2002-2011 胜达短信平台公司 版权所有 网站地图 XML