RES: IP to location / XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nathan, i'll try max minds geo ip, that's what i want.

-----Mensagem original-----
De: Nathan Rixham [mailto:nathan@xxxxxxxxx] 
Enviada em: segunda-feira, 2 de fevereiro de 2009 16:13
Para: php-general@xxxxxxxxxxxxx; Jônatas Zechim
Cc: 'PHP General'
Assunto: Re: IP to location / XML

Jônatas Zechim wrote:
> Hi there,
> 
> I want do discover the location from a IP, I use this url '
> http://www.onflex.org/geo/xml/ ', that's does a XML file, it's ok on my
> browser, but when i try to read this file with php:
> 
> $myxml = simplexml_load_file ('http://www.onflex.org/geo/xml/');
> 
> That's gives a error:
> 
> Warning: simplexml_load_file() [function.simplexml-load-file]:
> http://www.onflex.org/geo/xml/:8: parser error : Input is not proper
UTF-8,
> indicate encoding ! Bytes: 0xE3 0x6F 0x20 0x50 *****
> 
> 
> Anyone Who might help me with this?
> 
> zechim
> 
> 

try this:
$file = get_file_contents('http://www.onflex.org/geo/xml/');
$file = utf8_decode($file);
$myxml = simplexml_load_string($file);

the above assumes the problem is because the file is really latin-1

quick note, using the service at onflex.org will always return you're 
servers ip address not the end users (as you're calling from server not 
clients browser) if this is what you want great, if not then you may 
want to try max minds geo ip.

regards!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux