Advertisement
brianMc

Get IP From httpbin

May 29th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <meta charset="UTF-8">
  5.     <title>title</title>
  6.   </head>
  7.   <body>
  8.     <?php
  9.         $data = file_get_contents('http://httpbin.org/ip');
  10.         if (preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $data, $ip_match)) {
  11.         echo "<h1>IP Address: $ip_match[0]</h1>";
  12. }
  13.     ?>
  14.   </body>
  15. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement