IP online address minimal output and access methods

Script relocated to http://getip.110mb.com/mini/ !

Web browser  |  curl  |  lynx  |  wget  |  PHP  |  PERL  |   C/C++  |  VB   

 

Introduction

PHP IP address detection script is located at  http://getip.110mb.com/mini/index.php  and  can be accessed in differrent ways, described below.


http://getip.110mb.com/mini/ [index.php?v=a]
http://getip.110mb.com/mini/index.php [?v=a]
http://getip.110mb.com/mini/index.php?v=a|h|p|ah|ap|hp|ahp

a - show IP address (default),
h - show hostname (if resolved),
p - show proxy server (if detected),
ah, ap, hp, ahp, ...  - combinations of previous options,
o - HTML output.
( todo:  h - show help; u - show useragent; c - show country; w - show IP whois info; )

PHP script accepts both - GET and POST data passing methods.

Basic client IP address detection PHP script looks like this:

<?php 
 if (isSet($_SERVER)) {
  if (isSet($_SERVER["HTTP_CLIENT_IP"])) {
    $IP = $_SERVER["HTTP_CLIENT_IP"];
  } else {
      $IP = $_SERVER["REMOTE_ADDR"];
    }
 } 
 echo $IP;
?>

Note: depending on your network setup (fiewalls, proxy, NAT) and web browser settings, meaning of this IP address can be different.

 

 

IP address detection script access methods

Accessing with web browser

      http://getip.110mb.com/mini/
      http://getip.110mb.com/mini/index.php
      http://getip.110mb.com/mini/index.php?v=ahpo



Accessing with curl
     curl -s   http://getip.110mb.com/mini/index.php?v=ahp   (GET method)
     curl -d  "v=ahp"  http://needthe.net/viss/getip.php     (POST method)
     curl -s --connect-timeout 10 --proxy 200.63.213.2:553 
       http://getip.110mb.com/mini/index.php?v=ahp (via transparent proxy)
       (http://www.aliveproxy.com/transparent-proxy-list/)



Accessing with wget
      wget -q -O - http://getip.110mb.com/mini/index.php?v=ahp



Accessing with lynx
       lynx -dump http://getip.110mb.com/mini/index.php?v=ahpo 



Accessing with PHP
   <?php echo file_get_contents("http://getip.110mb.com/mini/"); ?>
   or  <?php echo readfile("http://getip.110mb.com/mini/index.php"); ?> 
   or  <?php echo @readfile("http://getip.110mb.com/mini/index.php?v=ahp"); ?> 
   or <?php echo $fh = fopen ("http://getip.110mb.com/mini/", r); 
       $data = fread($fh, 24); echo $data; ?> 
   
   or <?php exec ( "lynx  -dump $PAGE_URL" ); ?> 
   or <?php exec ( "links -dump $PAGE_URL" ); ?> 
   or <?php exec ( "some-curl-wget-...-command $PAGE_URL" ); ?> 




Accessing with PERL

      #!/usr/bin/perl
      use LWP::Simple; 
      $content = get("http://getip.110mb.com/mini/index.php"); 
      die "Couldn't get it!" unless defined $content; 
      print("$content\n"); 



Accessing with C/C++

On MS Windows - use these WIN API functions

- InternetOpen() 
- InternetOpenUrl() 
- InternetReadFile() 
- InternetCloseHandle()

// IP WAN address PHP script access with C/C++ on Windows OS
// http://show-ip.net/mini/
// 
// getip.c
// cl getip.c  wininet.lib  user32.lib

#include < windows.h >
#include < wininet.h > 
#include < stdio.h >

char output[16];
char getipurl[30] = "http://getip.110mb.com/mini/";
// char getipurl[45] = "http://getip.110mb.com/mini/index.php?v=ahp";
// adjust ReadSize value 



int GetIP(char *url)
{
	HINTERNET hInternet;
	HINTERNET hFile;
	DWORD ReadSize;
	BOOL  bResult;
       	
	hInternet = InternetOpen(
		"Some USER-AGENT",
		INTERNET_OPEN_TYPE_PRECONFIG,
		NULL,
		NULL,
		0);


	hFile = InternetOpenUrl(
		hInternet,
                url,
		NULL,
		0,
		INTERNET_FLAG_RELOAD,
		0);

	
		ReadSize = 15;
		bResult = InternetReadFile(
			hFile,
			output,
			15,
			&ReadSize);

		
	output[ReadSize] = '\0';
	
        printf("\n IP: %s\n", output);
      
	InternetCloseHandle(hFile);
	InternetCloseHandle(hInternet);
        return 0;
}


int main()
{
 GetIP(getipurl);
 return 0;
}



Download IP address lookup C CLI  programm with source (12 KB)

Getip - IP lookup C programm


On UNIX/LINUX:
...



Accessing with VB 

Download IP address lookup VB programm (5 KB)

WhatisMyIPAddress download VB programm

 


See also:

http://www.go2linux.org/what-is-my-public-ip-address-with-linux 
http://www.ibm.com/developerworks/library/os-php-readfiles/index.html 
http://www.governmentsecurity.org/archive/t14632.html 
http://www.debian-administration.org/articles/58 



Leave Your Comments and Suggestions Below

 

 

 

 

 

 

 

                

 Home  |  Online antivirus  |  Submit your website to search engines   |  Proxy   |  Rapidshare search   |  Downloads  |  User-agent Browserinfo  |  Google PageRank  |  WHOIS lookup

Social Bookmarking