Autor Beitrag
Opa
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Do 29.12.05 14:53 
Bei Delphi 6.0 habe ich immer diese Routine benutzt um eine IP hinter einem Router zu finden;
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
function _RouterIPFinden(Url:string):string;
var //uses NMHttp,SysUtils
  NHttp:TNMHTTP;
begin
  NHttp := TNMHTTP.Create(nil);
  try
    result := '';
    try
      NHttp.TimeOut := 20000;
      NHttp.Get(Url);
    except on E: Exception do exit;
    end;
    result := NHttp.Body;
  finally
    NHttp.Free;
  end;
end;

Dazu kommt noch eine php Datei auf dem Server:
<?
echo $_SERVER['REMOTE_ADDR'];
?>

In Delphi 7.0 gibt es aber nicht mehr >>TNMHTTP<< was kann man von Indy nehmen um dass gleiche zu erziehen?

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Do 29.12.05 15:12 
Würds mit TIdHTTP versuchen...

_________________
Bravery calls my name in the sound of the wind in the night...
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 29.12.05 15:13 
Moin!

Guckst du hier.

cu
Narses
Opa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Do 29.12.05 16:37 
Ich habe das jetzt getestet!
Mit Indy geht das so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TMain.Button1Click(Sender: TObject);
var //uses IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP
  IdHTTP :TIdHTTP;
begin
 IdHTTP := TIdHTTP.Create(nil);
 try
   IdHTTP.ReadTimeout := 20000;
   Memo1.Text:=idHTTP.Get('http://www.DeinServer.de/yourip.php');//siehe oben das PHP Teil
 finally
   IdHTTP.Free;
 end;
end;


Das Teil das Narses vorgeschlagen hat geht auch aber es geht NUR NOCH "whatismyip.com"! Alle anderen sind OFF, deswegen mache ich das mit Indy über meinen Server und dem php teil, da weiß ich das ich ON bin *g

MFG

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt