如何从Cookie中获取月份的日期?

时间:2019-01-29 15:38:32

标签: autoit

首先,我在google.com上进行请求 然后我得到值。 并拉出日期。

 $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
 $oHTTP.Open("GET", "https://google.com", False);    
 $oHTTP.Send();
 $HeaderResponses = $oHTTP.GetAllResponseHeaders();   cookie
 ;$resp=$oHTTP.ResponseText;                           html
 $date = StringRegExpReplace($HeaderResponses, '/^(?!.*$)(.*)$/', '/^(?!.*$)(.*)$/'); get date
 FileWriteLine("test.txt", $date); 

1 个答案:

答案 0 :(得分:0)

不确定是否对您的查询有用,

cpp
#include <StringConstants.au3>

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "https://google.com", False)
$oHTTP.Send()

$HeaderResponses = $oHTTP.GetAllResponseHeaders() ; cookie
;$resp = $oHTTP.ResponseText                      ; html

$datepostionstart = StringInStr($HeaderResponses,"Date:")
$datepostionstend = StringInStr($HeaderResponses,"GMT")
$firstsring       = StringLeft($HeaderResponses,$datepostionstend-10)

MsgBox(1,"",$firstsring)

$date = StringTrimLeft($firstsring,$datepostionstart+10)

MsgBox(1,"",$date)

FileWriteLine("test.txt", "Cookie Date = "&$date)