whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

34 Visitors Online


 
..get the IP-Address bhind a router/proxy?
Autor: Steffen Schirmer (Steve Tricky)
Homepage: http://tricky-soft.de.vu
[ Print tip ]  

Tip Rating (15):  
     


{
  Wenn man hinter einem Router oder Proxy seine richtige Internet-IP herausfinden möchte,
  dann brauch man die Hilfe von einem externen Internetserver, der einem die IP „verrät“.
  Realisierbar ist dies mit einer Kombination von PERL und DELPHI.
  Das folgende Perlscript muss auf einen Webspace, der CGI/Perl unterstützt geladen werden:

  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";
--------------------------------------------------------

{
  Wenn die Adresse des Script’s http://www.my-server.de/cgi-bin/GiveMeMyIp.pl ist,
  dann ist der Delphi Quelltext, um die IP rauszufinden:

  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;




 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners