Advertisement
Virajsinh

Get IP Address Details API JSON Formate

Nov 12th, 2021 (edited)
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. <?php
  2. // Alternative Site https://api.ipdata.co/
  3. $ip_address = $_SERVER["REMOTE_ADDR"];
  4. $url = "http://ip-api.com/json/$ip_address";
  5. $ch = curl_init();
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt($ch, CURLOPT_URL, $url);
  8. $response = curl_exec($ch);
  9. $arr_result = json_decode($response);
  10. echo($response);
  11. ?>
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement