【问题标题】:How to get the date of the month from the cookie?如何从 cookie 中获取月份的日期?
【发布时间】:2019-01-29 15:38:31
【问题描述】:

首先我在 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); 

【问题讨论】:

    标签: autoit


    【解决方案1】:

    不确定是否有帮助我为您的查询使用了字符串函数:

    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)
    

    【讨论】:

      猜你喜欢
      • 2011-01-03
      • 2018-12-08
      • 1970-01-01
      • 1970-01-01
      • 2012-02-16
      • 2021-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多