server.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:darkc0de-old-stuff 作者: tuwid 项目源码 文件源码
def senddata(self):
        filename = "output.txt"
        fileit = open(filename, 'r')
        done = 0
        while not done:
            output = fileit.readline()
            if output != "":
                # 'text' is the value needed to be past to the php script to put in db
                # the form name is text which is a textarea
                params = urllib.urlencode({'text': output})
                headers = {"Content-type": "application/x-www-form-urlencoded",
                                "Accept": "text/plain"}
                conn = httplib.HTTPConnection(linecache.getline('info.txt', 1))
                conn.request("POST", "/filewrite.php", params, headers)
                response = conn.getresponse()
                print response.status, response.reason
                data = response.read()        
            else:
                done = 1
        fileit.close()
        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号