TWinHTPP
/// a class to handle HTTP/1.1 request using the WinHTTP API
// - has a common behavior as THttpClientSocket() but seems to be faster
// over a network and is able to retrieve the current proxy settings
// (if available) and handle secure https connection - so it seems to be the
// class to use in your client programs
// - WinHTTP does not share any proxy settings with Internet Explorer.
// The WinHTTP proxy configuration is set by either
// $ proxycfg.exe
// on Windows XP and Windows Server 2003 or earlier, either
// $ netsh.exe
// on Windows Vista and Windows Server 2008 or later; for instance,
// you can run either:
// $ proxycfg -u
// $ netsh winhttp import proxy source=ie
// to use the current user's proxy settings for Internet Explorer (under 64-bit
// Vista/Seven, to configure applications using the 32 bit WinHttp settings,
// call netsh or proxycfg bits from %SystemRoot%\SysWOW64 folder explicitely)
// - Microsoft Windows HTTP Services (WinHTTP) is targeted at middle-tier and
// back-end server applications that require access to an HTTP client stack
///使用WinHTTP API处理HTTP/1.1请求的类
// -具有与THttpClientSocket()相同的行为,但似乎更快
//通过网络,并能够检索当前的代理设置
//(如果可用)和处理安全的HTTPS连接-所以它似乎是
//在客户端程序中使用的类
// - WinHTTP不与ie共享任何代理设置。
// WinHTTP代理配置由两者之一设置
// $ proxycfg.exe
// Windows XP和Windows Server 2003或更早版本
// $ netsh.exe
//在Windows Vista和Windows Server 2008或更高版本;例如,
//你可以运行:
// $ proxycfg -u
// $ netsh winhttp导入代理源=ie
//使用当前用户的Internet Explorer代理设置(64位以下
7、使用32位的WinHttp设置来配置应用程序
//从%SystemRoot%\SysWOW64文件夹中显式调用netsh或proxycfg位)
// -微软Windows HTTP服务(WinHTTP)是针对中间层和
//需要访问HTTP客户端堆栈的后端服务器应用程序
比THttpClientSocket 要更快,经过测试确实要快一些
FHttp:TWinHTTP;
1.先创建连接
TWinHTTP.Create('htpp://XXXX','443',True); //最后一个参数 是否为 https连接
2.接着去请求
FApiHttp.Request(APIVersion+API_AccesToken, 'POST', 0,'',Body.AsJSon,'application/json', OutHeader, OutData);
//参数:
//1.请求文件路径
//2.方法 POST GET...
//3.KeepAlive is in milliseconds, 0 for "Connection: Close" HTTP/1.0 requests
//4.请求头
//5.请求的内容
//6.请求内容类型
//7.返回头
//8.返回内容
函数返回 HttpStateCode
标签:HTTP,netsh,TWinHTTP,Windows,Delphi,proxycfg,SynCrtSock,proxy,WinHTTP From: https://www.cnblogs.com/BTag/p/17434738.html