public function actionConecta() { $p = new GetGeoIP(); $p->IPAddress = "98.138.253.109"; $cliente = new SoapClient('http://www.webservicex.net/geoipservice.asmx?WSDL', array('classmap' => array('GetGeoIP' => 'GetGeoIP', 'GeoIP' => 'GeoIP'))); $resultado = $cliente->GetGeoIP($p); print_r($resultado); }
function index() { $ip = $this->input->post('ipaddress', true); trim($ip); if (!filter_var($ip, FILTER_VALIDATE_IP) === false) { $c = new SoapClient('http://www.webservicex.net/geoipservice.asmx?WSDL'); $data = $c->GetGeoIP(array('IPAddress' => $ip)); $this->template['res'] = $data; $this->layout->load($this->template, 'ipaddress'); } else { $this->layout->load($this->template, 'invalid_ip'); } }
function get_user_country($ip_address) { if (check_live_server()) { //enable soap for this to work $client = new SoapClient("http://www.webservicex.net/geoipservice.asmx?WSDL"); $params = new stdClass(); $params->IPAddress = $ip_address; $result = $client->GetGeoIP($params); // Check for errors... return $result->GetGeoIPResult->CountryName; } else { //if on local host return uganda return 'Uganda'; } }