回复 1# sex123
#PRE_UseX64=n
Global $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Option(0) = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; BOIE9;ZHCN)"
Local $U1 = get_location("http://dx.doi.org/10.1038/ni.2417")
ConsoleWrite($U1 & @CRLF)
Local $U2 = get_location($U1)
ConsoleWrite($U2 & @CRLF)
Func get_location($sUrl, $sRef = "")
Local $sBody, $aMatch, $sReferer
$oHTTP.Option(6) = False
$oHTTP.Open("GET", $sUrl, True)
If $sRef <> "" Then $oHTTP.setRequestHeader("Referer", $sRef)
$oHTTP.Send()
$oHTTP.WaitForResponse(-1)
$sUrl = $oHTTP.getResponseHeader("Location")
;ConsoleWrite($oHTTP.getAllResponseHeaders() & @CRLF)
Return $sUrl
EndFunc
|