2583,23 → 2583,24 |
end; |
end; |
|
// http://www.delphipraxis.net/post43515.html |
Function GetHTML(AUrl: string): string; |
// https://www.delphipraxis.net/post43515.html , fixed , works for Delphi 12 Athens |
function GetHTML(AUrl: string): RawByteString; |
var |
databuffer : array[0..4095] of char; |
ResStr : string; |
databuffer : array[0..4095] of ansichar; // SIC! ansichar! |
ResStr : ansistring; // SIC! ansistring |
hSession, hfile: hInternet; |
dwindex,dwcodelen,dwread,dwNumber: cardinal; |
dwcode : array[1..20] of char; |
res : pchar; |
Str : pchar; |
Str : pansichar; // SIC! pansichar |
begin |
ResStr:=''; |
if pos('http://',lowercase(AUrl))=0 then |
if (system.pos('http://',lowercase(AUrl))=0) and |
(system.pos('https://',lowercase(AUrl))=0) then |
AUrl:='http://'+AUrl; |
|
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then Application.ProcessMessages; |
|
hSession:=InternetOpen('InetURL:/1.0', |
INTERNET_OPEN_TYPE_PRECONFIG, |
2609,7 → 2610,7 |
if assigned(hsession) then |
begin |
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then application.ProcessMessages; |
|
hfile:=InternetOpenUrl( |
hsession, |
2622,7 → 2623,7 |
dwCodeLen := 10; |
|
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then application.ProcessMessages; |
|
HttpQueryInfo(hfile, |
HTTP_QUERY_STATUS_CODE, |
2640,23 → 2641,23 |
begin |
|
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then application.ProcessMessages; |
|
if dwRead =0 then |
break; |
databuffer[dwread]:=#0; |
Str := pchar(@databuffer); |
Str := pansichar(@databuffer); |
resStr := resStr + Str; |
end; |
end |
else |
ResStr := 'Status:'+res; |
ResStr := 'Status:'+AnsiString(res); |
if assigned(hfile) then |
InternetCloseHandle(hfile); |
end; |
|
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then application.ProcessMessages; |
|
InternetCloseHandle(hsession); |
Result := resStr; |