# -*- 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 
 

评论关闭
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!