怎么post表单,和get网页信息并处理! 谁能给写一个简单的例子 500分给上,,up有分

wocsdn 2005-03-14 10:00:57
怎么给某url 提交 表单 信息!

get网页信息并处理! (可设置多线程最好)

谁写的效率高,谁先得!

谁能给写一个简单的例子 500分给上,,up有分
...全文
156 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
jdh2010 2005-03-15
  • 打赏
  • 举报
回复
up
dophin1003 2005-03-15
  • 打赏
  • 举报
回复
c也可以做网页吗?
wocsdn 2005-03-15
  • 打赏
  • 举报
回复
能写一个比较完成点的吗???最好有注释哦!可以编译的,,,偶没学过c

所以求救各为高手了
Cnxiaowei 2005-03-14
  • 打赏
  • 举报
回复
举一个登录动网论坛的例子(POST):
CString strData;
CString strHeaders;
strHeaders = "Content-Type: application/x-www-form-urlencoded";
strData = "username=Cnxiaowei&password=hahahaha&CookieDate=1&userhidden=1";
char buff[100000];
CInternetSession session;
CHttpConnection * conn = session.GetHttpConnection("192.168.0.168");
CHttpFile * file = conn->OpenRequest("POST","bbs/login.asp?action=chk");
file->AddRequestHeaders(strHeaders);
file->SendRequest(NULL,0,(LPVOID)(LPSTR)(LPCTSTR)strData,strData.GetLength());
file->Read(buff,100000);
AfxMessageBox(buff);

zhousqy 2005-03-14
  • 打赏
  • 举报
回复
楼上的5星啊!
蒋晟 2005-03-14
  • 打赏
  • 举报
回复
参考MSDn中的微软知识库文章
Q165298 How To Simulate a Form POST Request Using WinInet
For more information on how to use a URL Moniker to simulate a form POST request, please refer to the following article in the Microsoft Knowledge Base:
Q165800 SAMPLE: Using a URL Moniker to POST Data
Q290591 How To Submit Form Data by Using XMLHTTP or ServerXMLHTTP Object
Q311294 HOW TO: Host a WebBrowser Control in Visual Basic .NET to Post Form Data
Q167858 How To Automate Internet Explorer to POST Form Data
效率是WinInet最高,但是对于复杂的网页可能无法提交正确的数据。
僵哥 2005-03-14
  • 打赏
  • 举报
回复
不好意思,以为是Delphi版,转成Delphi了.
-------------------------------------------
Socket->SendText(
"GET /avcenter/download/pages/US-N95.html HTTP/1.1\r\n
Host: securityresponse.symantec.com\r\nAccept: */*\r\n
Referer: http://securityresponse.symantec.com/avcenter/defs.download.html\r\n
User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)\r\n
Pragma: no-cache\r\n
Cache-Control: no-cache\r\n
Connection: close\r\n\r\n");
-------------------------------------------
Socket->SendText("POST \/zzcx2.asp HTTP/1.1\r\nAccept: image\/gif, image\/x-xbitmap, image\/jpeg, image\/pjpeg, application\/vnd.ms-powerpoint, application\/vnd.ms-excel, application\/msword, application\/x-shockwave-flash, *\/*\r\nReferer: http:\/\/train.chinamor.cn.net\/zztt.asp\r\nAccept-Language: zh-cn\r\nContent-Type: application\/x-www-form-urlencoded\r\nAccept-Encoding: gzip, deflate\r\nUser-Agent: Mozilla\/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\nHost: "+Host+"\r\nContent-Length: 23\r\nConnection: close\r\nCache-Control: no-cache\r\n\r\nbug=1&fzm=上海&dzm=广州");
-------------------------------------------
僵哥 2005-03-14
  • 打赏
  • 举报
回复
Socket.SendText(AccessStr);
---------------------------------------
一个Http Get会话实例数据:
--------------------------------------
Socket->SendText(
'GET /avcenter/download/pages/US-N95.html HTTP/1.1'+#13#10+
'Host: securityresponse.symantec.com'+#13#10+
'Accept: */*'+#13#10+
'Referer: http://securityresponse.symantec.com/avcenter/defs.download.html'+#13#10+
'User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)'+#13#10+
'Pragma: no-cache'+#13#10+
'Cache-Control: no-cache'+#13#10+
'Connection: close'+#13#10#13#10);
----------------------------------------------------
僵哥 2005-03-14
  • 打赏
  • 举报
回复
一个Form Post Http会话实例数据:
----------------------------------------
AccessStr:=
'POST /zzcx2.asp HTTP/1.1'+#13#10+
'Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*'+#13#10+
'Referer: http://train.chinamor.cn.net/zztt.asp'+#13#10+
'Accept-Language: zh-cn'+#13#10+
'Content-Type: application/x-www-form-urlencoded'+#13#10+
'Accept-Encoding: gzip, deflate'+#13#10+
'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)'+#13#10+
'Host: '+ClientSocket1.Host+#13#10+
'Content-Length: 23'+#13#10+
'Connection: close'+#13#10+
'Cache-Control: no-cache'+#13#10#13#10+
'bug=1&fzm=上海&dzm=广州';

69,369

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧