
Untitled
By: a guest on
Aug 12th, 2012 | syntax:
None | size: 1.09 KB | hits: 6 | expires: Never
// LIST OF TIMEZONES: http://markitup.com/WebServices/TimeZones.asmx/GetTimeZoneNames
// WEB SERVICE ADDRESS: http://markitup.com/WebServices/TimeZones.asmx/CurrentDateTime?timeZoneName=[TIMEZONE]
class (time,socket) {
constructor() {
#echo trying to connect
$$->$connect("markitup.com",80)
}
connectFailedEvent() {
#echo connection failed
echo "Couldn't connect to markitup.com"
}
connectEvent() {
#echo /WebServices/TimeZones.asmx/CurrentDateTime?timeZoneName=%Timezone HTTP/1.1\r\n
$$->$write("GET /WebServices/TimeZones.asmx/CurrentDateTime?timeZoneName=%Timezone HTTP/1.1\r\n")
$$->$write(Host: www.markitup.com\r\n)
$$->$write(Connection: close\r\n\r\n)
}
dataAvailableEvent() {
#echo reading data
%Data = %Data + $$->$read($0)
}
disconnectEvent() {
//echo disconnected from server
//echo %Data
%splitData = $str.split("\n", %Data)
$$->%date = $str.replace($str.lefttofirst($str.rightfromfirst($str.grep("<datetime", %splitData, r, 0), ">"), "<"), " ", "T")
msg $$->%chan $$->%name"'s local time is currently" $$->%date"."
}
}