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.
-
<?php
-
class WhatIsMyIp {
-
private function extractIpAddress($text) {
-
"/(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]?)/",
-
$text, $matches)) {
-
$ip = $matches[0];
-
}
-
return $ip;
-
}
-
-
public function getServerIpAddress() {
-
return $this->extractIpAddress($file);
-
}
-
}
-
?>
Tags: PHP code, PHP script, Review script PHP, Script code, Source code
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.


(4 votes, average: 4.5 out of 5)
Leave a Reply