Wininet笔记一-创新互联

1,

成都创新互联是专业的路南网站建设公司,路南接单;提供成都网站设计、成都网站建设、外贸网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行路南网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

InternetOpen 创建根句柄,由下一层的 InternetOpenUrl 和 InternetConnect 使用,
而 InternetConnect 创建的句柄又被之后的几个函数使用。
HINTERNET InternetOpen(
_In_ LPCTSTR lpszAgent,
_In_ DWORD   dwAccessType,
_In_ LPCTSTR lpszProxyName,
_In_ LPCTSTR lpszProxyBypass,
_In_ DWORD   dwFlags
);Initializes an application's use of the WinINet functions.初始化winnet。
lpszAgent [in]
Pointer to a null-terminated string that specifies the name of the application or entity calling the WinINet functions. This name is used as the user agent in the HTTP protocol.
lpszAgent参数指定了调用wininet函数的应用程序或实体名称,并使用来填充http协议头的UserAgent字段。

2,

HINTERNET InternetOpenUrl(
_In_ HINTERNET hInternet,
_In_ LPCTSTR   lpszUrl,
_In_ LPCTSTR   lpszHeaders,
_In_ DWORD     dwHeadersLength,
_In_ DWORD     dwFlags,
_In_ DWORD_PTR dwContext
); Opens a resource specified by a complete FTP or HTTP URL.打开URL指定的资源。
lpszHeaders [in]
A pointer to a null-terminated string that specifies the headers to be sent to the HTTP server. For more information, see the description of the lpszHeaders parameter in the HttpSendRequest function.指定发送到server的http头信息。
dwContext [in]
A pointer to a variable that specifies the application-defined value that is passed, along with the returned handle, to any callback functions.一个指向一个应用程序定义的值,将随着返回的句柄,一起传递给回调函数。


3,

HINTERNET InternetConnect(
_In_ HINTERNET     hInternet,
_In_ LPCTSTR       lpszServerName,
_In_ INTERNET_PORT nServerPort,
_In_ LPCTSTR       lpszUsername,
_In_ LPCTSTR       lpszPassword,
_In_ DWORD         dwService,
_In_ DWORD         dwFlags,
_In_ DWORD_PTR     dwContext
); Opens an File Transfer Protocol (FTP) or HTTP session for a given site.
lpszServerName [in]
Pointer to a null-terminated string that specifies the host name of an Internet server. Alternately, the string can contain the IP number of the site, in ASCII dotted-decimal format (for example, 11.0.1.45).主机的域名或IP地址。
nServerPort [in]
Transmission Control Protocol/Internet Protocol (TCP/IP) port on the server. These flags set only the port that is used.

dwContext [in]
InternetOpenUrl设置传回掉函数的指针。

4,


5,


6,

HINTERNET HttpOpenRequest(
_In_ HINTERNET hConnect,
_In_ LPCTSTR   lpszVerb,
_In_ LPCTSTR   lpszObjectName,
_In_ LPCTSTR   lpszVersion,
_In_ LPCTSTR   lpszReferer,
_In_ LPCTSTR   *lplpszAcceptTypes,
_In_ DWORD     dwFlags,
_In_ DWORD_PTR dwContext
); Creates an HTTP request handle.
一旦和服务器的连接已经建立,我们打开了想要的文件。HttpOpenRequest去创建个请求句柄并且把参数存储在句柄中,HttpSendRequest把请求参数送到HTTP服务器。

lpszVerb指定请求的方法为"GET"、"PUT"或"POST",值填NULL默认为"GET"。
lpszObjectName指定页面地址,通常为文件名称、可执行模块或者查找标识符,如/MSDN/MSDNINFO/
lpszVersion标识HTTP版本,如"HTTP/1.1"


lpszReferer指定包含lpszObjectName文档的网址。
lplpszAcceptTypes表示客户接受的内容类型。如果该字符串为NULL,服务器认为客户接受"text/*"类型的文档 (也就是说,只有纯文本文档,并且不是图片或其它二进制文件)。内容类型与CGI变量CONTENT_TYPE相同,该变量确定了要查询的含有相关信息的 数据的类型,如HTTP POST和PUT。

文章名称:Wininet笔记一-创新互联
文章起源:https://www.cdcxhl.com/article16/doogdg.html

成都网站建设公司_创新互联,为您提供建站公司定制网站品牌网站建设网站维护网站策划微信公众号

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

小程序开发