URL_DOMAIN
URL_DOMAIN
URL_DOMAIN Domain portion of the Google Maps Time Zone API URL.
A PHP wrapper for the Google Maps TimeZone API.
The Google Maps Time Zone API provides a simple interface to request the time zone for a location on the earth, as well as that location's time offset from UTC. The API provides time offset data for locations on the surface of the earth. Requests for the time zone information are made for a specific latitude/longitude pair and date. The API returns the name of that time zone (in different languages), the time offset from UTC, and the daylight savings offset in a user-selectable format (XML or JSON). In order to be able to use this class, it's necessary to provide an API key or, for business clients, Client ID and signing key.
__construct(float $latitude, float $longitude, integer|string $timestamp, string $format = self::FORMAT_JSON) : \GoogleMapsTimeZone
Constructor. The request is not executed until `queryTimeZone()` is called.
| float | $latitude | latitude of the location of the location to get timezone information for. Default: 0 |
| float | $longitude | longitude of the location of the location to get timezone information for. Default: 0 |
| integer|string | $timestamp | point in time to get timezone information from. Default: 0 (current time) |
| string | $format | optional response format (JSON default) |
setFormat(string $format) : \GoogleMapsTimeZone
Set the response format (JSON or XML).
| string | $format | response format |
setLatitudeLongitude(float|string $latitude, float|string $longitude) : \GoogleMapsTimeZone
Set the latitude/longitude of the location to get timezone information for
| float|string | $latitude | latitude |
| float|string | $longitude | longitude of the location of the location to get timezone information for |
setLatitude(float|string $latitude) : \GoogleMapsTimeZone
Set the latitude of the location of the location to get timezone information for
| float|string | $latitude | latitude of the location of the location to get timezone information for |
setLongitude(float|string $longitude) : \GoogleMapsTimeZone
Set the longitude of the location to get timezone information for
| float|string | $longitude | longitude of the location of the location to get timezone information for |
setTimestamp(integer|string $timestamp) : \GoogleMapsTimeZone
Set the point in time to get timezone information for (used to determine whether or not DST is active).
This can be used to get the selected place's timezone in a point in time.
| integer|string | $timestamp | point in time to get timezone information for. Default: 0 (current time) |
setLanguage(string $language) : \GoogleMapsTimeZone
Set the language code in which to return results.
| string | $language | language code |
setApiKey(string $apiKey) : \GoogleMapsTimeZone
Set the API key to authenticate with.
| string | $apiKey | API key |
setClientId(string $clientId) : \GoogleMapsTimeZone
Set the client ID for Business clients.
| string | $clientId | client ID |
setSigningKey(string $signingKey) : \GoogleMapsTimeZone
Set the cryptographic signing key for Business clients.
| string | $signingKey | cryptographic signing key |
queryTimeZone(boolean $raw = false, resource $context = null) : string|array|\SimpleXMLElement
Execute the timezone request. The return type is based on the requested format: associative array if JSON, SimpleXMLElement object if XML.
Queries are performed using cURL and, if not available, using file_get_contents()
| boolean | $raw | If true, the function returns the raw (string) response. Otherwise, it returns an array or SimpleXMLElement object with the decoded response. |
| resource | $context | stream context from |
response in requested format