Autor Beitrag
DorJo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: So 25.05.08 19:50 
Hy @ all,
gibt es irgendeine Möglichkeit die IP von einer bestimmten Website herauszufinden? Die IdHTTP Kompo schickt ja prinzipiell eine Anfrage mit dem Namen der I-Netseite an einen Nameserver, odr? Und da müsste sie doch egtl. eine IP dieser Seite zurückkriegen... kann man die irgendwie herauskriegen?

Danke schon ma im Vorraus

Dor Jo
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: So 25.05.08 20:20 
Das Stichwort dazu lautet Suche in Wikipedia DNS.
In Delphi kannst du dazu z.B. Suche in der Entwickler-Ecke TIDDNSRESOLVER benutzen.

Gruß
alias5000

_________________
Programmers never die, they just GOSUB without RETURN
DorJo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: So 25.05.08 20:37 
hmm
und wie funzt das genau?! =O! Sry ar entweder bin ich zu blöd für diese welt odr es is komisch ^^
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: So 25.05.08 20:43 
Bei den Demos zu Indy (im Programmverzeichnis von Delphi/Demos) ist IMHO ein entsprechender Codeschnipsel dabei.
Eine schnelle Lösung dafür sollte in etwa sowas hergeben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  IdDNSResolver1.Active := true;
  IdDNSResolver1.Host := Domain;
  IdDNSResolver1.Resolve(Domain);
  IPAdresse := (IdDNSResolver1.QueryResult.Items[0as TARecord).IPAddress;

Dort sind aber keine Fehlerfälle und so mit abgefangen (falls die DNS-Auflösung fehlschlagen sollte und so)

Gruß
alias5000

_________________
Programmers never die, they just GOSUB without RETURN
DorJo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: So 25.05.08 23:11 
@alias5000

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  IdDNSResolver1.Active := true;
  IdDNSResolver1.Host := adresse.text;
  IdDNSResolver1.Resolve(adresse.text);
  IPAdresse := (IdDNSResolver1.QueryResult.Items[0as TARecord).IPAddress;
  ShowMessage(IPAdresse);


Hmm :( wenn mein Editfeld (addresse) den Wert "http://www.google.de" hat kommt bei dem resolve befehl die fehlermeldung:
Ungültige Abfragezahl 0

... Was is da falsch? :( muss ich vielleicht noch irgendne unit einbauen odr so?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 25.05.08 23:26 
Moin!

user profile iconDorJo hat folgendes geschrieben:
wenn mein Editfeld (addresse) den Wert "http://www.google.de" hat kommt bei dem resolve befehl die fehlermeldung:
Der Host heißt www.google.de, das http:// hat als Protokollangabe bei einer DNS-Anfrage da nix zu suchen. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
DorJo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: So 25.05.08 23:30 
user profile iconNarses hat folgendes geschrieben:
Der Host heißt www.google.de, das http:// hat als Protokollangabe bei einer DNS-Anfrage da nix zu suchen. :idea:
Ähm... k ;) wenn du das sagst ^^ Ar es kommt trotzdem die gleiche Fehlermeldung bei www.google.de! :(
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 25.05.08 23:33 
Moin!

user profile iconDorJo hat folgendes geschrieben:
Ar es kommt trotzdem die gleiche Fehlermeldung bei www.google.de! :(
Hm, doofe Indy-Kompos... :?

Hier gibt´s noch eine Alternative dazu: die Funktionen GetIPbyName() machen auch eine DNS-Auflösung. Probier´s mal damit (im Beispielprogramm ist die Verwendung im Detail zu sehen).

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
DorJo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: So 25.05.08 23:45 
user profile iconNarses hat folgendes geschrieben:
die Funktionen GetIPbyName() machen auch eine DNS-Auflösung.

:oops: ich glaub ich bin zu blöd ar bei der GetIPbyName was hat da diese IPv4 für ein Format?! :oops:
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 25.05.08 23:48 
user profile iconNarses in dem Unit-Beitrag hat folgendes geschrieben:
Es kann für den Typ in_addr (IPv4-Adresse) nötig sein, noch WinSock in die uses-Klausel einzufügen.
:zwinker:

_________________
There are 10 types of people - those who understand binary and those who don´t.
DorJo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: Mo 26.05.08 00:06 
oh verdammt... stimmt... hmm es is echt zu spät -.-


Zitat:
IPv4: enthält nach dem Aufruf die IP(v4)-Adresse oder -1 im Fehlerfall

hmm... ar was is denn da das jetz für ein format... hmm irgendwie bin ich heut schlecht drauf... ich versteh nur bahnhof... wie kann ich denn darauf zugreifen?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 26.05.08 00:47 
Moin!

user profile iconDorJo hat folgendes geschrieben:
Zitat:
IPv4: enthält nach dem Aufruf die IP(v4)-Adresse oder -1 im Fehlerfall

hmm... ar was is denn da das jetz für ein format...
Schonmal den Quelltext der PingDemo angeschaut? :roll: ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
DorJo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: Mo 26.05.08 01:04 
Moin. Also verzeih bitte mein langsames Denken heute... Aber irgendwie seh ich grad nicht mehr so richtig klar. Also. Ich kann doch mittels IPv4.S_addr auf den Integerwert zugreifen, odr? :oops: ar da kommt bei mir bei google.de 166.353.263.2
... hmm ... wenn ich mich zu blöd anstelle... dann haut mich bitte ^^
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 26.05.08 01:27 
Moin!

Probier das mal so: ;)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
uses
  ..., Ping, WinSock;

procedure TForm1.Button1Click(Sender: TObject);
  var
    IP: in_addr;
begin
  if GetIPByName(Edit1.Text,IP) then
    Edit1.Text := inet_ntoa(IP)
  else
    Edit1.Text := 'Fehler!';
end;
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 26.05.08 09:18 
Ich will ja nicht pedantisch sein, aber als Programmierer habe ich es mir, auch manchmal auch zum Leidwesen meiner Freundin angewöhnt, mich möglichst genau auszudrücken. Und in diesen Fall bedeutet das: Eine Webseite hat keine IP. Nur der Server auf dem die Webseite liegt, hat eine IP. Warum ist mir das so wichtig? Ganz einfach, weil wenn man sein Problem genau beschreiben kann, hat man es schon fast gelöst. Es muss also nicht die IP der Webseite rausgefunden werden, sondern es muss die URI des Servers in eine IP-Adresse zurückverwandelt werden. Und damit hat man schon fast einen Suchansatz für das Forum oder Google.
DorJo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: Mo 26.05.08 14:48 
DANKE NARSES! Funktioniert super!