This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
cgi_script_to_print_visitor_ip [2011/10/10 17:45] k2patel |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | <code cgi | index.cgi> | ||
- | #!/usr/bin/perl -wT | ||
- | use CGI qw(:standard); | ||
- | print "Content-type: text/html\n\n"; | ||
- | #print "<pre>\n"; | ||
- | if ($ENV{HTTP_X_FORWARDED_FOR}){ | ||
- | print $ENV{HTTP_X_FORWARDED_FOR}; | ||
- | } | ||
- | else | ||
- | { | ||
- | print $ENV{REMOTE_ADDR}; | ||
- | } | ||
- | print "\n"; | ||
- | </code> | ||
- | Try it here !! | ||
- | |||
- | <code bash> | ||
- | curl ip.k2patel.in | ||
- | </code> |