我如何在Firemonkey平台(Android/iOS)获取网页的文本/HTML内容?TWebBrowser没有相关功能...
我如何在Firemonkey平台(Android/iOS)获取网页的文本/HTML内容?TWebBrowser没有相关功能...
通过一些测试,我将JavaScript和Delphi代码结合起来,有一个解决方法,请参考我的文章:http://firemonkeylessons.blogspot.tw/2015/01/get-htmljson-from-twebbrowser.html
这是我用来获取HTML文本的方法
function GetURL(const AURL: string): string;
var
HttpClient: THttpClient;
HttpResponse: IHttpResponse;
begin
HttpClient := THTTPClient.Create;
try
HttpResponse := HttpClient.Get(AURL);
// memo1.Text:=HttpResponse.ContentAsString();
Result := HttpResponse.ContentAsString();
finally
HttpClient.Free;
end;
end;
TIdHTTP
),而不是WinINet。 - Marcus Adams