我希望能够构造一个原始的HTTP请求,并使用套接字发送它。显然,您希望我使用像urllib和urllib2这样的东西,但我不想使用它们。
它必须看起来像这样:
import socket
tcpsoc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcpsoc.bind(('72.14.192.58', 80)) #bind to googles ip
tcpsoc.send('HTTP REQUEST')
response = tcpsoc.recv()
显然,您还必须请求页面/文件以及get和post参数
https://stackoverflow.com/questions/5755507
复制相似问题