宝峰科技

 找回密码
 注册

QQ登录

只需一步,快速开始

宝峰科技 门户 词条 API函数大全 WinInet 查看内容
宝塔服务器面板

API函数:WinInet的HttpOpenRequest打开一个HTTP请求句柄的函数介绍

2012-3-18 22:36| 发布者: admin| 查看: 7618| 评论: 0

摘要: HttpOpenRequest 函数原型:HINTERNET HttpOpenRequest(HINTERNET hConnect, LPCTSTR lpszVerb, LPCTSTR lpszObjectName, LPCTSTR lpszVersion, LPCTSTR lpszReferrer, LPCTSTR *lplpszAcceptTypes, DWORD dwFlags, ...
HttpOpenRequest 函数原型
HINTERNET HttpOpenRequest(
HINTERNET hConnect,
LPCTSTR lpszVerb,  
LPCTSTR lpszObjectName,
LPCTSTR lpszVersion,
LPCTSTR lpszReferrer,
LPCTSTR *lplpszAcceptTypes,
DWORD dwFlags,
DWORD dwContext );

HttpOpenRequest 函数的作用:
打开一个 HTTP 请求的句柄。
HttpOpenRequest 函数的返回值:
HttpOpenRequest 函数执行成功返回一个非空 HTTP 请求的有效句柄,否则返加 NULL 。为了获取扩展的错误信息,可用 GetLastError 函数来获取。返回值类型为 HINTERNET ,整数型。
HttpOpenRequest 函数的参数介绍:
参数一:hConnect 为 WinInet 建立 Internet 连接的句柄。可用 InternetConnect 函数所取得。类型为 HINTERNET ,整数型。
参数二:lpszVerb 指向一个以空字符结尾的字符串,在请求中使用动词名称指针。如果该参数为NULL,那么默认值为“GET”。类型为 LPCTSTR ,字符串指针。
参数三:lpszObjectName 指向一个以空字符结尾的字符串,其中包含指定动词的目标对象的名称。这通常是一个文件名,可执行模块,或搜索符。类型为 LPCTSTR ,字符串指针。
参数四:lpszVersion 指向一个以空字符结尾的字符串,参数为 HTTP 版本的指针。如果此参数为 NULL,则该函数用"HTTP/1.0"作为版本。类型为 LPCTSTR ,字符串指针。
参数五: lpszReferrer 指向一个空字符结尾的字符串,它是指定文本的 URL 请求 (lpszObjectName) 中获得文本的地址 (URL) 。如果此参数为 NULL,则指定没有"referrer"。类型为 LPCTSTR ,字符串指针。
参数六:lplpszAcceptTypes 指向一个以空字符结尾的字符串,表示客户接受的内容类型的指针的数组指针。如果这个参数是NULL,客户端没有任何类型可接收。如果服务器解析到没有接受的类型,则客户端接受唯一的文件类型“text/*”。类型为 LPCTSTR ,字符串数组指针。
参数七:dwFlags 指定互联网标志位的掩码。参数类型为 DWORD ,整数型。可以是下面常数的任何值:
INTERNET_FLAG_CACHE_IF_NET_FAIL Return the resource from the cache if the network request for the resource fails due to an ERROR_INTERNET_CONNECTION_RESET or ERROR_INTERNET_CANNOT_CONNECT.  //从缓存中返回该资源,如果网络资源请求失败,是因一个常数ERROR_INTERNET_CONNECTION_RESET或ERROR_INTERNET_CANNOT_CONNECT 引起的。
INTERNET_FLAG_DONT_CACHE Not supported. Data is never cached. //从不缓存
INTERNET_FLAG_HYPERLINK Forces a reload if there was no Expires time and no Last-Modified time returned from the server when determining whether to reload the item from the network.  //如果没有过期时间和没有从服务器返回的最后修改时间,决定是否重新从网络强制重载。
INTERNET_FLAG_IGNORE_CERT_CN_INVALID Disables Win32 Internet function checking of SSL/PCT-based certificates that are returned from the server against the host name given in the request. Win32 Internet functions use a simple check against certificates by comparing for matching host names and simple wildcarding rules.  //禁用的Win32上网功能的SSL / PCT基于对请求主机名从服务器返回的证书检查。 Win32的上网功能使用匹配的主机名和简单的通配符规则比较简单的检查打击证书。
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID Disables Win32 Internet function checking of SSL/PCT-based certificates for proper validity dates.  //禁用Win32的上网功能检查的SSL / PCT适当的有效日期的证书。
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP Disables the ability of the Win32 Internet functions to detect this special type of redirect. When this flag is used, Win32 Internet functions transparently allow redirects from HTTPS to HTTP URLs.  
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS Disables the ability of the Win32 Internet functions to detect this special type of redirect. When this flag is used, Win32 Internet functions transparently allow redirects from HTTP to HTTPS URLs.  
INTERNET_FLAG_KEEP_CONNECTION Uses keep-alive semantics, if available, for the connection. This flag is required for Microsoft Network (MSN), NT LAN Manager (NTLM), and other types of authentication.  
INTERNET_FLAG_MAKE_PERSISTENT Not supported.  
INTERNET_FLAG_MUST_CACHE_REQUEST Causes a temporary file to be created if the file cannot be cached. Identical to the preferred value INTERNET_FLAG_NEED_FILE.  
INTERNET_FLAG_NEED_FILE Causes a temporary file to be created if the file cannot be cached.  
INTERNET_FLAG_NO_AUTH Does not attempt authentication automatically.  
INTERNET_FLAG_NO_AUTO_REDIRECT Does not automatically handle redirection in HttpSendRequest.  
INTERNET_FLAG_NO_CACHE_WRITE Does not add the returned entity to the cache.  
INTERNET_FLAG_NO_COOKIES Does not automatically add cookie headers to requests, and does not automatically add returned cookies to the cookie database.  
INTERNET_FLAG_NO_UI Disables the cookie dialog box.  
INTERNET_FLAG_PRAGMA_NOCACHE Forces the request to be resolved by the origin server, even if a cached copy exists on the proxy.  
INTERNET_FLAG_READ_PREFETCH This flag is currently disabled.  
INTERNET_FLAG_RELOAD Not supported. Data is always from the wire and caching is not supported.  
INTERNET_FLAG_RESYNCHRONIZE Reloads HTTP resources if the resource has been modified since the last time it was downloaded.  
INTERNET_FLAG_SECURE Uses SSL/PCT transaction semantics.  
参数八:dwContext 指定的应用程序定义的值,将此操作相关联的任何应用程序数据。类型 DWORD  ,整数型。

VB 中的声明:
Public Declare Function HttpOpenRequest Lib "wininet.dll" Alias "HttpOpenRequestA" _
(ByVal hHttpSession As Long, _
ByVal sVerb As String, _
ByVal sObjectName As String, _
ByVal sVersion As String,_
ByVal sReferer As String, _
ByVal something As Long, _
ByVal lFlags As Long,_
ByVal lContext As Long) As Long

易语言中的DLL命令定义:
.版本 2

.DLL命令 HttpOpenRequest, 整数型, "wininet.dll", "HttpOpenRequestA", , 打开一个HTTP请求的句柄
    .参数 hInternetSession, 整数型, , 连接句柄
    .参数 lpszVerb, 文本型, 传址, 空为“GET”,否则为“POST”
    .参数 lpszObjectName, 文本型, 传址, 命令对象,通常是一个文件名,可执行文件或一个搜索
    .参数 lpszVersion, 文本型, 传址, HTTP版本为空则使用“HTTP/1.0”
    .参数 lpszReferer, 文本型, 传址, 一个网址,可为空
    .参数 lpszAcceptTypes, 文本型, 传址, 程序接收的文件类型列表
    .参数 dwFlags, 整数型
    .参数 dwContext, 整数型


鲜花

握手

雷人

路过

鸡蛋

相关阅读

相关分类

免责声明

本站中所有被研究的素材与信息全部来源于互联网,版权争议与本站无关。本站所发布的任何软件编程开发或软件的逆向分析文章、逆向分析视频、补丁、注册机和注册信息,仅限用于学习和研究软件安全的目的。全体用户必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。学习编程开发技术或逆向分析技术是为了更好的完善软件可能存在的不安全因素,提升软件安全意识。所以您如果喜欢某程序,请购买注册正版软件,获得正版优质服务!不得将上述内容私自传播、销售或者用于商业用途!否则,一切后果请用户自负!

QQ|Archiver|手机版|小黑屋|联系我们|宝峰科技 ( 滇公网安备 53050202000040号 | 滇ICP备09007156号-2 )

Copyright © 2001-2023 Discuz! Team. GMT+8, 2024-3-28 19:14 , File On Powered by Discuz! X3.49

返回顶部