Autor Beitrag
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 28

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 30.06.05 15:42 
hallo, angenommen ich bin auf www.google.de/blablalba.xyz und im quelltext habe ich den bildpfad /images/logo_sm.gif stehen, dann komme ich da ja nur ran, wenn ich das auf www.google.de kürze und das /images/logo_sm.gif hinten ran hänge, aber wie kürze ich die url auf das root verzeichnis mit delphi ? :roll:
direction4delphi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 84

WIN 95, WIN 98, WIN ME, WIN NT, WIN 2000, WIN XP, VISTA
D2 Prof, D4 Prof,D2005 Prof, Delphi4Php
BeitragVerfasst: Fr 01.07.05 08:37 
Nimm den String und check mal ob die ersten 7 Zeichen http:// sind -> wenn ja lauf die einzelnen chars des Strings solange durch bis du eine / findest dann hast die Root URL.

mfg
MILLI
F34r0fTh3D4rk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 28

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Fr 01.07.05 09:45 
stimmt, aber was ist, wenn schon der root angegeben ist, mach ich dann '/' bzw #0 ? sollte doch gehen oder ?

danke :D
direction4delphi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 84

WIN 95, WIN 98, WIN ME, WIN NT, WIN 2000, WIN XP, VISTA
D2 Prof, D4 Prof,D2005 Prof, Delphi4Php
BeitragVerfasst: Fr 01.07.05 09:54 
user profile iconF34r0fTh3D4rk hat folgendes geschrieben:
stimmt, aber was ist, wenn schon der root angegeben ist, mach ich dann '/' bzw #0 ? sollte doch gehen oder ?

danke :D


Ikch würde prinzipell den letzten / immer wegschneiden solltest du aber 2 // haben ist es für eine url auch kein prob

mfg
MILLI
beber
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 21

WXP, VistaU
D2007W32
BeitragVerfasst: Fr 01.07.05 11:40 
Hoi,

also ich benutze immer folgendes:

ausblenden Delphi-Quelltext
1:
uses WinInet;					


ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
 
var
  aURLC: TURLComponents;
  foundwebserver:String;
  myURL:String;
begin
 myURL := '';  // uebergebe hier den link, welchen du zerpfluecken willst.
 FillChar(aURLC, SizeOf(TURLComponents), 0);
 with aURLC do
  begin
    lpszScheme := nil;
    dwSchemeLength := INTERNET_MAX_SCHEME_LENGTH;
    lpszHostName := nil;
    dwHostNameLength := INTERNET_MAX_HOST_NAME_LENGTH;
    lpszUserName := nil;
    dwUserNameLength := INTERNET_MAX_USER_NAME_LENGTH;
    lpszPassword := nil;
    dwPasswordLength := INTERNET_MAX_PASSWORD_LENGTH;
    lpszUrlPath := nil;
    dwUrlPathLength := INTERNET_MAX_PATH_LENGTH;
    lpszExtraInfo := nil;
    dwExtraInfoLength := INTERNET_MAX_PATH_LENGTH;
    dwStructSize := SizeOf(aURLC);
  end;

            if InternetCrackUrl(PChar(myURL), Length(myURL), 0, aURLC) then
              begin
                lbl1.Caption := aURLC.lpszScheme;
                listbox1.Items.add('lpszScheme: '+aURLC.lpszScheme);
                foundwebserver := Copy(aURLC.lpszScheme,1,length(aURLC.lpszScheme)-length(aurlc.lpszUrlPath));
                listbox1.items.Add('#######');
                listbox1.items.Add('Server: '+foundwebserver);
                listbox1.Items.add('lpszHostName: '+aURLC.lpszHostName);
                listbox1.Items.add('lpszUserName: '+aURLC.lpszUserName);
                listbox1.Items.add('lpszPassword: '+aURLC.lpszPassword);
                listbox1.Items.add('lpszUrlPath: '+aURLC.lpszUrlPath);
                listbox1.Items.add('lpszExtraInfo: '+aURLC.lpszExtraInfo);
              end;
  
end;


Leg zum test einfach eine listbox rein.

HTH
Bertram
F34r0fTh3D4rk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 28

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Fr 01.07.05 12:04 
so gehts auch, danke werde mal schauen was ich nehme, sieht aber schonmal sehr schön aus, danke :D