Realm Posted May 13, 2010 Posted May 13, 2010 I was wondering if anyone knows a way for in which when I begin to run my script, it could obtain a current date timestamp from a server or website, particularly my website? My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.
Fire Posted May 13, 2010 Posted May 13, 2010 (edited) Hi RealmUsing trancexx UDFAnd Working Example:(see below)P.S You need place WinHTTP.au3 in same folder with this example.It works for me and OutPut for me:expandcollapse popup#include "WinHTTP.au3" $nOffset = 1 $input=InputBox("Enter Site URL","ENTER SITE URL","","") $hOpen = _WinHttpOpen() $hConnect = _WinHttpConnect($hOpen, $input) $hRequest = _WinHttpOpenRequest($hConnect, "GET", "/") _WinHttpSendRequest($hRequest) _WinHttpReceiveResponse($hRequest) If _WinHttpQueryDataAvailable($hRequest) Then $header = _WinHttpQueryHeaders($hRequest) _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) FileWrite(@TempDir&"\headerinfo.txt",$header) EndIf $str=FileRead(@TempDir&"\headerinfo.txt") While 1 $array = StringRegExp($str, '(?i)Date: (.*?)(?i)GMT', 1, $nOffset) If @error = 0 Then $nOffset = @extended Else ExitLoop EndIf for $i = 0 to UBound($array) - 1 msgbox(0, "DATE:", $array[$i],10) FileDelete(@TempDir&"\headerinfo.txt") Next WEnd Edited May 13, 2010 by Fire [size="5"] [/size]
Realm Posted May 14, 2010 Author Posted May 14, 2010 Fire, Thanks for reply, that is a perfect example for what I need, and also thanks for pointing out trancexx's UDF I see alot of future uses with that as well. My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now