public static function WebServiceUtility::getUrl in Smart IP 8.4
Same name in this branch
- 8.4 modules/smart_ip_ipinfodb_web_service/src/WebServiceUtility.php \Drupal\smart_ip_ipinfodb_web_service\WebServiceUtility::getUrl()
- 8.4 modules/smart_ip_abstract_web_service/src/WebServiceUtility.php \Drupal\smart_ip_abstract_web_service\WebServiceUtility::getUrl()
- 8.4 modules/smart_ip_maxmind_geoip2_web_service/src/WebServiceUtility.php \Drupal\smart_ip_maxmind_geoip2_web_service\WebServiceUtility::getUrl()
Same name and namespace in other branches
- 8.2 modules/smart_ip_ipinfodb_web_service/src/WebServiceUtility.php \Drupal\smart_ip_ipinfodb_web_service\WebServiceUtility::getUrl()
- 8.3 modules/smart_ip_ipinfodb_web_service/src/WebServiceUtility.php \Drupal\smart_ip_ipinfodb_web_service\WebServiceUtility::getUrl()
Get Smart IP's data source module's web service URL.
Parameters
string $ipAddress: IP address to query for geolocation.
Return value
string Smart IP's data source module's web service URL.
Overrides WebServiceUtilityInterface::getUrl
1 call to WebServiceUtility::getUrl()
- WebServiceUtility::getGeolocation in modules/
smart_ip_ipinfodb_web_service/ src/ WebServiceUtility.php - Perform HTTP request and decoding the raw Geolocation data returned by Smart IP's data source module web service.
File
- modules/
smart_ip_ipinfodb_web_service/ src/ WebServiceUtility.php, line 25 - Contains \Drupal\smart_ip_ipinfodb_web_service\WebServiceUtility.
Class
- WebServiceUtility
- Utility methods class wrapper.
Namespace
Drupal\smart_ip_ipinfodb_web_serviceCode
public static function getUrl($ipAddress = NULL) {
if (!empty($ipAddress)) {
$config = \Drupal::config(SmartIpEventSubscriber::configName());
$apiKey = $config
->get('api_key');
$version = $config
->get('version');
if ($version == 2) {
return IpinfodbWebService::V2_URL . "?key={$apiKey}&ip={$ipAddress}&output=json&timezone=false";
}
elseif ($version == 3) {
return IpinfodbWebService::V3_URL . "?key={$apiKey}&ip={$ipAddress}&format=json";
}
}
return '';
}