编程高手进--如何Post,以及post之后服务器的返回文件什么样子

来源:百度知道 编辑:UC知道 时间:2024/06/01 12:01:41
我是菜鸟,近期接触网络编程。有个问题很疑惑:
关于http请求,大家都知道主要包括Post和Get 两种方式。
我近期想实现一个程序,老师说非常简单,但我不明白一些地方,请高手指教下:
下面以中华美食网为例:http://www.zhms.cn
打开之后,有一个“菜谱”搜索栏,正常地浏览过程是:
1.往关键字栏里填入“糖醋鱼”
2.再点“搜索”
3.会弹出一个结果页面出来。
现在,我想用程序模拟出这个过程,初步这样想的:
1.查看html代码,发现<form id="soform" name="soform" method="post" action="socate.asp">就是说:提交是用的post方法,
2.于是可以post消息给服务器
到了这里就卡住了,因为我不清楚:
一:post的格式是怎么样的传递给服务器的
二:服务器返回了什么给客户端的html文件
---------------------------------------------------
以上就是我的问题,困扰一周了,请路过的高手不吝赐教.谢谢
进一步:
三:如果我有30种菜单,我想让程序自动得出所有的结果,又该如何做呢?
承诺:若能答出前面的一、二题,本人100分相送。
如果有第三问如果可写出源代码的话,另赠100分。我的邮箱Rebornor@qq.com
一楼的感觉速度挺快哈!
我们用的是vc6.0,你提到的一些类库好像不支持,所以说不太符合。
最好有VC6.0的代码
再重新问下:服务器返回客户端的是什么形式的数据呢?

The following table shows the steps you might perform in a typical HTTP client application:

Begin an HTTP session.
Create a CInternetSession object.
Initializes WinInet and connects to server.

Connect to an HTTP server.
Use CInternetSession::GetHttpConnection.
Returns a CHttpConnection object.

Open an HTTP request.
Use CHttpConnection::OpenRequest.
Returns a CHttpFile object.

Send an HTTP request.
Use CHttpFile::AddRequestHeaders and CHttpFile::SendRequest.
Finds the file. Returns FALSE if the file is not found.

Read from the file.
Use CHttpFile.
Reads the specified number of bytes using a buffer you supply.

Handle exceptions.
Use the CInternetException class.
Handles all common Internet exception types.

End the HTTP session.
Dispose of the CInternetSession object.
Automatically cleans up open file handles and connecti