|
Online (WAN) IP address minimal output and access methods Script located at http://show-ip.net/getip/Web
browser | curl
| lynx |
wget
| PHP | PERL
| C/C++ | VB
|
|
|
Introduction PHP IP address detection script is located at http://show-ip.net/getip/index.php and can be accessed in differrent ways, described below.
<?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 http://show-ip.net/getip/
http://show-ip.net/getip/index.php
http://show-ip.net/getip/index.php?v=ahpo
Accessing with curl curl -s http://show-ip.net/getip/index.php?v=ahp (GET method)
curl -d "v=ahp" http://show-ip.net/getip/index.php (POST method)
curl -s --connect-timeout 10 --proxy 200.63.213.2:553
http://show-ip.net/getip/index.php?v=ahp (via transparent proxy)
(http://www.aliveproxy.com/transparent-proxy-list/)Accessing with wget wget -q -O - http://show-ip.net/getip/index.php?v=ahp Accessing with lynx
lynx -dump http://show-ip.net/getip/index.php?v=ahpo Accessing with PHP <?php echo file_get_contents("http://show-ip.net/getip/"); ?>
or <?php echo readfile("http://show-ip.net/getip/index.php"); ?>
or <?php echo @readfile("http://show-ip.net/getip/index.php?v=ahp"); ?>
or <?php echo $fh = fopen ("http://show-ip.net/getip/", 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" ); ?>
#!/usr/bin/perl
use LWP::Simple;
$content = get("http://show-ip.net/getip/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()
// 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://show-ip.net/getip/";
// char getipurl[45] = "http://show-ip.net/getip/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)
On UNIX/LINUX: ... Accessing with VB
Download IP
address lookup VB programm (5 KB)
http://www.go2linux.org/what-is-my-public-ip-address-with-linux
|
|
|
| |
|
Home | Online antivirus | Submit your website to search engines | Proxy | Rapidshare search | Downloads | User-agent Browserinfo | Google PageRank | WHOIS lookup
|
|