Registriert seit: 20. Jul 2005
Ort: Schwerin
152 Beiträge
Delphi 7 Professional
|
Re: urldownloadtofile
30. Nov 2005, 19:23
habe jetzt mehrere varianten versucht erste variante:
Delphi-Quellcode:
idhttp1.Get('http://www.billiger-surfen.de/tarifliste.php3?&abc=all',t1);
t1.Write(s,t1.Size);
memo1.Lines.Add(s);
zweite variante:
Delphi-Quellcode:
urldownloadtofile(nil,'http://www.billiger-surfen.de/tarifliste.php3?&abc=all','c:\windows\desktop\billiger\tarifliste.php3',0,nil);
//memo1.Lines.Add(GetHTML('http://www.billiger-surfen.de/tarifliste.php3?&abc=all'));
und dritte variante:
Delphi-Quellcode:
Function GetHTML(AUrl: string): string;
var databuffer : array[0..4095] of char;
ResStr : string;
hSession, hfile: hInternet;
dwindex,dwcodelen,dwread,dwNumber: cardinal;
dwcode : array[1..20] of char;
res : pchar; Str : pchar;
begin
ResStr:='';
Result:='';
if pos('http://',lowercase(AUrl))=0 then AUrl:='http://'+AUrl;
hSession:=InternetOpen('InetURL:/1.0',INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);
If assigned(hSession) Then Try hfile:=InternetOpenUrl(hsession,pchar(AUrl),nil,0,INTERNET_FLAG_RELOAD,0);
if assigned(hfile) then Try dwIndex := 0;
dwCodeLen := 10;
HttpQueryInfo(hfile,HTTP_QUERY_STATUS_CODE,@dwcode,dwcodeLen,dwIndex);
res := pchar(@dwcode);
dwNumber := sizeof(databuffer)-1;
if (res ='200') or (res ='302') then begin while (InternetReadfile(hfile,@databuffer,dwNumber,DwRead)) AND (dwRead <>0) do begin
databuffer[dwread]:=#0;
Str := pchar(@databuffer);
resStr := resStr + Str;
Application.ProcessMessages;
end;
end else
ResStr := 'Status:'+res;
Finally
InternetCloseHandle(hfile);
End;
Finally
InternetCloseHandle(hsession);
End;
Result := ResStr;
end;
und
memo1.Lines.Add(GetHTML('http://www.billiger-surfen.de/tarifliste.php3?&abc=all'));
alle 3 varianten funktionieren nicht, warum nicht?
|
|
Zitat
|