linux中HTTP方式向服务器发送请求
在linux中如何用http的方式向服务器发送请求,协议要怎么写,,
[解决办法]
用libcurl库吧。
http://curl.haxx.se/libcurl/
[解决办法]
1、建立与服务器80端口的tcp连接
2、发送http请求,http是基于文本的协议,类似于:
GET /form.html HTTP/1.1 \n\r
User-Agent:Mozilla/4.0(compatible;MSIE6.0;Windows NT 5.0) \n\r
Host:www.guet.edu.cn \n\r
Connection:Keep-Alive \n\r
\n\r
具体协议可以参考http://blog.qdaxb.me/http%E5%8D%8F%E8%AE%AE%E8%AF%A6%E8%A7%A3/