_WinINet如何设置超时,或者关闭句柄?
#include-Once#include <WinINet.au3>
MsgBox(0, '', _WinINetEX_GetSource('http://www.a.com/'))
Func _WinINetEX_GetSource($s_URL)
Local $__URL_INFO = _WinINet_InternetCrackUrl($s_URL), $i = 1
Local $_SOURCE = Binary("")
Local $iStartup = _WinINet_Startup()
$hInternetOpen = _WinINet_InternetOpen("Mozilla/5.0 Firefox/3.0.1", $INTERNET_OPEN_TYPE_DIRECT, 0, Default, Default)
$hInternetConnect = _WinINet_InternetConnect($hInternetOpen, $INTERNET_SERVICE_HTTP, $__URL_INFO, 0, 0, Default, Default, 0)
$hHttpOpenRequest = _WinINet_HttpOpenRequest($hInternetConnect, "GET", $__URL_INFO & $__URL_INFO, $INTERNET_FLAG_RELOAD, "HTTP/1.1", Default, Default, 0)
$hHttpSendRequest = _WinINet_HttpSendRequest($hHttpOpenRequest, Default, Default)
Do
$_SOURCE &= _WinINet_InternetReadFile($hHttpOpenRequest, 6000)
Until @error <> 0 Or Not @extended
Return BinaryToString($_SOURCE, 1)
EndFunc ;==>_WinINetEX_GetSource
网上好像是说WININET的BUG无法设置TIMEOUT
碰碰运气看看有人知道不! $hHttpSendRequest = _WinINet_HttpSendRequest($hHttpOpenRequest, Default, Default)
到这句就卡住了! AdlibRegister来监控也不行 会暂停住 本帖最后由 netegg 于 2013-10-11 01:42 编辑
#Include <WinHTTP.au3>
_WinHttpSetTimeouts
_WinHttpReceiveResponse( $hRequest ) #Include
_WinHttpSetTimeouts
_WinHttpReceiveResponse( $hRequest )
netegg 发表于 2013-10-11 01:40 http://www.autoitx.com/images/common/back.gif
不一样
_WinHttp和_Wininet 是不一样,不过可以通着用 是不一样,不过可以通着用
netegg 发表于 2013-10-11 01:45 http://www.autoitx.com/images/common/back.gif
实在没办法就只能用_WinHttp了
_Wininet还是方便很多的,可以和进程共享COOKIE
页:
[1]