首页  编辑  

获取代理、路由后面的IP?

Tags: /超级猛料/Network.网络通讯/代理/   Date Created:

get the IP-Address bhind a router/proxy?

{

 If you are behind a router or proxy and want to get your real Internet-IP-Address then you

 need the help of a extern Internet Server. That extern Internet server have to tell you your

 real Ip-Address.  You can make this with a combination of PERL and DELPHI.

 The following PERL-SCRIPT you have to upload to an Webspace witch allows Perl/CGI-access:

}

--------------------------------------------------------

#!/usr/local/bin/perl

use CGI qw/:standard/;

print "Content-type: text/html\n\n";

print "BEGINIP".$ENV{REMOTE_ADDR}."ENDIP";

--------------------------------------------------------

{

 If the address of the Script is "http://www.my-server.de/cgi-bin/GiveMeMyIp.pl"

 then the Delphi-Code to get your real IP is:

}

procedure TForm1.Button1Click(Sender: TObject);

var

 IPSTR, IP, HP: string;

 BeginIP, EndIP, i: integer;

begin

 Button1.Enabled := False;

 HP      := 'http://www.my-server.de/cgi-bin/GiveMeMyIp.pl';

   NMHTTP1.Get(HP);

 IPSTR   := (NMHTTP1.Body);

 BeginIP := Pos('BEGINIP', IPSTR) + Length('BEGINIP');

 EndIP   := Pos('ENDIP', IPSTR);

 IP      := '';

 for i := BeginIP to ENDip - 1 do

 begin

   IP := IP + IPstr[i];

 end;

 label1.Caption  := IP;

 Button1.Enabled := True;

end;