IP address checker script

You need to know your IP address before checking anonymity. If you have only one server it’s not a problem. Hardcode and forget. But what if you have several servers? As I said before, automation is the king.

Say thank you to people who cares about us. Grab URL(s) you like, extract IP and be happy. The WhatIsMyIp class (whatismyip.php) will help you in the beginning.

  1. <?php
  2. class WhatIsMyIp {
  3. private function extractIpAddress($text) {
  4. $ip = NULL;if (preg_match(
  5. "/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/",
  6. $text, $matches)) {
  7. $ip = $matches[0];
  8. }
  9. return $ip;
  10. }
  11.  
  12. public function getServerIpAddress() {
  13. $file = file_get_contents(/*[URL YOU LIKE]*/);
  14. return $this->extractIpAddress($file);
  15. }
  16. }
  17. ?>

Tags: , , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 4.5 out of 5)
Loading ... Loading ...

Leave a Reply

Random Articles