Jump to content
Nytro

[RST] IP Locator

Recommended Posts

  • Moderators
Tind sa ii dau dreptate lui Lubbock

http://api.ipinfodb.com/v2/ip_query.php?key=409f44a12b8bccd245b898f11300a54abfb709ca89f4ce8905d12e21f4bbe982&ip=127.0.0.1

Inlocuiesti 127.0.0.1 cu IP-ul pe care vrei sa-l cauti si iti da toate datele despre el.

EDIT: Sau daca vrei demo:

http://dragosgaftoneanu.com/rsts/ip.php

Sursa:

<form action="" method="post">
IP: <input type="text" name="ip"><input type="submit" value="Verifica">
</form>
<br />
<?php
if($_POST['ip']!="")
{
$ss = file_get_contents("http://api.ipinfodb.com/v2/ip_query.php?key=409f44a12b8bccd245b898f11300a54abfb709ca89f4ce8905d12e21f4bbe982&ip=" . $_POST['ip']);
echo "Cod tara: ", get_string_between($ss,'<CountryCode>','</CountryCode>');
echo "<br />Tara: ", get_string_between($ss,'<CountryName>','</CountryName>');
echo "<br />Oras: ", get_string_between($ss,'<City>','</City>');
echo "<br />Latitudine: ", get_string_between($ss,'<Latitude>','</Latitude>');
echo "<br />Longitudine: ", get_string_between($ss,'<Longitude>','</Longitude>');
}


function get_string_between($string, $start, $end){
$string = " ".$string;
$ini = strpos($string,$start);
if ($ini == 0) return "";
$ini += strlen($start);
$len = strpos($string,$end,$ini) - $ini;
return substr($string,$ini,$len);
}
?>

Edited by Dragos
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...