<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: IP Location API by ipwhois.io</title>
    <description>The latest articles on DEV Community by IP Location API by ipwhois.io (@ipwhoisio).</description>
    <link>https://dev.to/ipwhoisio</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F215529%2F32504bc4-03b2-454c-9be4-f4a3143b0421.png</url>
      <title>DEV Community: IP Location API by ipwhois.io</title>
      <link>https://dev.to/ipwhoisio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ipwhoisio"/>
    <language>en</language>
    <item>
      <title>IP Geolocation &amp; IP Location Lookup API </title>
      <dc:creator>IP Location API by ipwhois.io</dc:creator>
      <pubDate>Thu, 22 Aug 2019 11:14:44 +0000</pubDate>
      <link>https://dev.to/ipwhoisio/ip-geolocation-and-ip-location-lookup-api-oj0</link>
      <guid>https://dev.to/ipwhoisio/ip-geolocation-and-ip-location-lookup-api-oj0</guid>
      <description>&lt;p&gt;The service &lt;a href="https://ipwhois.io/"&gt;IP Geolocation&lt;/a&gt; is free for the test and small applications and sites.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Development&lt;/b&gt;&lt;br&gt;
Due to powerful and optimized servers located on different continents and productive database, achieve a real response of up to 90 milliseconds in most parts of the world.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;PHP Library&lt;/b&gt;&lt;br&gt;
&lt;a href="https://github.com/ipwhois-io/IP-Geolocation-API"&gt;Go to Github Project&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;PHP Function&lt;/b&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ip = "CLIENT_IP_ADDRESS";
$location = get_ipwhois($ip);
$decodedLocation = json_decode($location, true);

echo "&amp;lt;pre&amp;gt;";
print_r($decodedLocation);
echo "&amp;lt;/pre&amp;gt;";

function get_ipwhois($ip, $format = "json", $lang = "en") {
    $url = "http://free.ipwhois.io/".$format."/".$ip."?lang=".$lang;
    $cURL = curl_init();

    curl_setopt($cURL, CURLOPT_URL, $url);
    curl_setopt($cURL, CURLOPT_HTTPGET, true);
    curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Accept: application/json'
    ));
    return curl_exec($cURL);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>api</category>
    </item>
  </channel>
</rss>
