# -*- coding: cp936 -*-
import urllib2
import urllib
def postHttp(name=None,tel=None,address=None,
price=None,num=None,paytype=None,
posttype=None,other=None):
url="http://www.xxx.com/dog.php"
#定义要提交的数据
postdata=dict(name=name,tel=tel,address=address,price=price,
num=num,paytype=paytype,posttype=posttype,other=other)
#url编码
postdata=urllib.urlencode(postdata)
#enable cookie
request = urllib2.Request(url,postdata)
response=urllib2.urlopen(request)
print response
调用函数:
网友评论
文明上网理性发言,请遵守 新闻评论服务协议我要评论
立即提交
专题推荐独孤九贱-php全栈开发教程
全栈 100W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
玉女心经-web前端开发教程
入门 50W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
天龙八部-实战开发教程
实战 80W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习