本帖最后由 huangke 于 2013-1-22 15:39 编辑
可能我有强迫症,不想用IE.AU3 UDF,如何读取这个网址(http://www.timedate.cn/worldclock/ti.asp)的内容“2013年1月22日 星期二 14:19:03”
如下的代码中没有JS生成的‘2013年1月22日 星期二 14:19:03’之类的文本。。。where is it?.gif)
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET","http://www.timedate.cn/worldclock/ti.asp")
$oHTTP.Send()
$Source = $oHTTP.responseBody
$Source = BinaryToString($Source, 1)
MsgBox(0, '结果:', $Source)
Exit
或者用InetRead
$http = 'http://www.timedate.cn/worldclock/ti.asp'
$sData = InetRead($http)
$Source = BinaryToString($sData, 1)
MsgBox(0, 0, $Source)
;--------------------------------------------------------------
今天一连问了两个问题,都被大家热心解决了。。。。鸡冻中。。。。.gif)
Local $http = 'http://www.timedate.cn/worldclock/ti.asp'
Local $sData = InetRead($http)
Local $Source = BinaryToString($sData, 1)
Local $aSR = StringRegExp($Source, 'n\w+\=(\d+)', 3)
If @error Or UBound($aSR) < 7 Then Exit
Local $Array[8] = ['日', '一', '二', '三', '四', '五', '六', '日']
MsgBox(0, '', StringFormat('%d年%d月%d日 星期%s %02d:%02d:%02d', $aSR[0], $aSR[1], $aSR[2], $Array[$aSR[3]], $aSR[4], $aSR[5], $aSR[6]))
|