public static function WebServiceUtility::getGeolocation in Smart IP 8.2
Same name and namespace in other branches
- 8.4 modules/smart_ip_ipinfodb_web_service/src/WebServiceUtility.php \Drupal\smart_ip_ipinfodb_web_service\WebServiceUtility::getGeolocation()
- 8.3 modules/smart_ip_ipinfodb_web_service/src/WebServiceUtility.php \Drupal\smart_ip_ipinfodb_web_service\WebServiceUtility::getGeolocation()
Perform HTTP request and decoding the raw Geolocation data returned by Smart IP's data source module web.
Parameters
string $ipAddress: IP address to query for geolocation.
Return value
array
Overrides WebServiceUtilityInterface::getGeolocation
1 call to WebServiceUtility::getGeolocation()
- SmartIpEventSubscriber::processQuery in modules/
smart_ip_ipinfodb_web_service/ src/ EventSubscriber/ SmartIpEventSubscriber.php - Act on \Drupal\smart_ip\SmartIp::query() when executed and if selected as Smart IP data source, query the IP address against its database.
File
- modules/
smart_ip_ipinfodb_web_service/ src/ WebServiceUtility.php, line 40 - Contains \Drupal\smart_ip_ipinfodb_web_service\WebServiceUtility.
Class
- WebServiceUtility
- Utility methods class wrapper.
Namespace
Drupal\smart_ip_ipinfodb_web_serviceCode
public static function getGeolocation($ipAddress = NULL) {
$url = self::getUrl($ipAddress);
$json = self::sendRequest($url);
$data = (object) Json::decode($json);
return $data;
}