IP address checker script

PHP script — By Script on September 18, 2009 at 12:38 pm

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. ?>
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 4.5 out of 5)
Loading ... Loading ...

Random Articles

0 Comments

You can be the first one to leave a comment.

Leave a Comment


Tags: ,