python urllib2练习发送简单post

import urllib2
import urllib
url = 'http://localhost/1.php'
while True:
    data = raw_input('(ctrl+c exit)cmd>').strip()
    post = {}
    post['cmd'] = data

    content = urllib2.urlopen(url=url,data=urllib.urlencode(post))
    print content.read()

 

posted on 2017-06-01 10:01  Perl6  阅读(342)  评论(0编辑  收藏  举报

导航