Last active
March 13, 2019 10:17
-
-
Save adnan360/bd5e9f1b770804ec23887692307c7864 to your computer and use it in GitHub Desktop.
Get URL Content in Lazarus - using TFPHttpClient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FPHTTPClientDownload(URL: string; SaveToFile: boolean = false; Filename: string = ''): string; | |
begin | |
Result := ''; | |
With TFPHttpClient.Create(Nil) do | |
try | |
try | |
if SaveToFile then begin | |
Get(URL, Filename); | |
Result := Filename; | |
end else begin | |
Result := Get(URL); | |
end; | |
except | |
on E: Exception do | |
ShowMessage('Error: ' + E.Message); | |
end; | |
finally | |
Free; | |
end; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment