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()
相關文章
相關標籤/搜索