Jump to content
xisto Community
Sign in to follow this  
dogtag

Ip Info

Recommended Posts

Here is my 5th Code:
By this class you can have many informations about an IP address:


<?phpclass ipinfo{	var $remote_addr;	var $address;	var $country;	var $state;	var $city;	var $isp;	var $organization;		function ipinfo()	{		$this->remote_addr = $_SERVER["REMOTE_ADDR"];	}		function check($ip = false)	{		if ($ip == false)		$ip = $this->remote_addr;		$postfields = "custom_ip_address=".urlencode($ip)."&submit=".urlencode("lookup any ip");				$ch = curl_init();		curl_setopt($ch, CURLOPT_URL, 'http://forums.xisto.com/no_longer_exists/;;		curl_setopt($ch, CURLOPT_HEADER, true);		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);		curl_setopt($ch, CURLOPT_POST, true);		curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);		curl_setopt($ch, CURLOPT_REFERER, "http://http://www.ip-adress.com/IP_adresse/;;		//curl_setopt($ch, CURLOPT_PROXY, '211.233.74.24:80'); //To use proxy!		$html = curl_exec($ch);		curl_close($ch);						if($html)		{			$start = strpos($html, '</form>');			$end = strpos($html, '<p align="left"></p>') - $start;						$html2 = trim(substr($html, $start, $end));			$html2 = trim(ereg_replace("<([^>]+)>", "", $html2));			$html2 = ereg_replace("\n", "<br>", $html2);						$html3 = explode("<br>", $html2);						/* //If you want to use arrays			$ipinfo = array();			$ipinfo["address"] = trim($html3[1]);			$ipinfo["country"] = trim($html3[10]);			$ipinfo["state"] = trim($html3[15]);			$ipinfo["city"] = trim($html3[19]);			$ipinfo["isp"] = trim($html3[31]);			$ipinfo["organization"] = trim($html3[35]);			$this->ipinfo = $ipinfo;			*/						$this->address = trim($html3[1]);			$this->country = trim($html3[10]);			$this->state = trim($html3[15]);			$this->city = trim($html3[19]);			$this->isp = trim($html3[31]);			$this->organization = trim($html3[35]);		}	}}$ipinfo = new ipinfo;echo "<b>Check my IP:</b><br><br>";$ipinfo->check();echo	"IP Address: ".$ipinfo->address;echo	"<br>Country: ".$ipinfo->country;echo	"<br>State: ".$ipinfo->state;echo	"<br>City: ".$ipinfo->city;echo	"<br>ISP :".$ipinfo->isp;echo	"<br> Organization :".$ipinfo->organization."<br><br><br>";echo "<b>Check custom IP:</b><br><br>";$ipinfo->check("72.14.221.99");echo	"IP Address: ".$ipinfo->address;echo	"<br>Country: ".$ipinfo->country;echo	"<br>State: ".$ipinfo->state;echo	"<br>City: ".$ipinfo->city;echo	"<br>ISP :".$ipinfo->isp;echo	"<br> Organization :".$ipinfo->organization;?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.