关于winsock发送http的post请求问题
我想做一个客户端软件,有这样的功能.
我发送讲求到服务端的asp或者php页面,然后我需要接收他的响应,分析页面返回给我的数据,再做一些处理.
因为我发送的数据量可能有些大,所以我用到了post.
我的post的请求头是这样的:
"POST /test.asp HTTP/1.1
Host:192.168.1.135
Accept:*/*
User-Agent:yoocun /1.0
Connection:Keep-Alive
Content-Type:application/x-www-form-urlencoded
Content_Length:14
id=1&type=http
"
注:因为是做测试,所以用了简单的数据
test.asp是我用来做测试的页面,里面代码如下:
<html>
<body>
<%
dim id2
dim type2
id2 = request("id")
type2 = request("type")
response.write id2
response.write type2
%>
sdkfjhsldfj;sldfks;dlfsldfk
</body>
</html>
我希望得到如下的结果:
<html>
<body>
1http
sdkfjhsldfj;sldfks;dlfsldfk
</body>
</html>
可是我收到的总是不是这样的结果,不知道原因在哪里?
以下是我收到的回应:
"HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Sat, 08 Sep 2007 03:27:12 GMT
Content-Length: 68
Content-Type: text/html
Set-Cookie: ASPSESSIONIDCSASCSBC=NBPNKGABGDMDJPKIJHLPNJGF; path=/
Cache-control: private
"
"<html>
<body>
sdkfjhsldfj;sldfks;dlfsldfk
</body>
</html>HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/5.1
Date: Sat, 08 Sep 2007 03:41:42 GMT
Content-Type: text/html
Content-Length: 87
<html><head><title>Error</title></head><body>The parameter is incorrect. </body></html>"
回应是分两次接收的,asp的代码好像没有执行.那位大哥知道原因,相烦指点下!
在这里谢谢先!