vADC Forum

Reply
Contributor
Posts: 29
Registered: ‎10-19-2013
Accepted Solution

timezone of client to use in STM trafficscript

Hi All,

does anybody already managed to use the clients-timezone within a trafficscript rule?

i know it could be found via javascript-function, but i don't have a idea how to transport this information to STM...

-Jochen

Brocadian
Posts: 58
Registered: ‎11-29-2012

Re: timezone of client to use in STM trafficscript

One example using an external service to map the geoip information into a timezone name or ID.


$ip = request.getRemoteIP();


$lat = geo.getLatitude( $ip );


$long = geo.getLongitude( $ip );



$googlejson = http.request.get( 'https://maps.googleapis.com/maps/api/timezone/json?location='.$lat.','.$long.'&timestamp=0&sensor=false' );



$googlehash = json.deserialize( $googlejson );


$timeZoneName = $googlehash['timeZoneName'];


$timeZoneId = $googlehash['timeZoneId'];



log.info( "Time Zone Name: ".$timeZoneName );


log.info( "Time Zone ID: ".$timeZoneId );


*This rule will add the time it will take to look up the information form Google.

**I would read the  The Google Time Zone API - Google Maps API Web Services — Google Developers before use. You may want to get your own key.

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.

Download FREE NVMe eBook