LAMW and TFPHTTPClient lazarus / 43-Android ---------------------------------------------------------------------- bobkos · 2020-03-06 09:04 Hi everyone, I'm stuck a bit, and hope somebody can assist me. Thanks in advance. I need to get JSON doc from remote server via HTTPS, so I've prepared simple code to get it which is working good on my Windows running PC, nevertheless when I'm trying to get it work on my Android application it's breaking with exception "Hostname resolution for '%hostname%' failed". My assumption that the problem is in HTTPS connection itself, while HTTP execution not leading to error. So my question, is there any way to get it work. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  fphttpclient, fpopenssl, openssl; ... function GetReceipt:string;var  counter,APos:integer;  AStream:TStream;  AUID:string;begin  AUID:='';  AStream:=TStream.Create;  with TFPHTTPClient.Create(nil) do    try    AddHeader('User-Agent','Mozilla/5.0 (compatible; TestApp)');      IOTimeout:=3000;      try        HTTPMethod('GET','https://consumer.oofd.kz/api/tickets/find-by-url?i=3 759879297&f=600300097026&s=5032.0&t=20200304T092700',AStream,[302]);    except on E:Exception do        Result:=e.message;      end;      for counter:=0 to ResponseHeaders.Count-1 do        if Pos('Location',ResponseHeaders[counter]) = 0 then Continue else begin          APos:=Pos('/ticket',ResponseHeaders[counter]);          AUID:= Copy(ResponseHeaders[counter],APos,Length(ResponseHeaders[counter])- APos+1);          Break;        end;     //AUID should be something like this '/ticket/ce658ee5-4c10-4c33-b9e9-994ec6226099'      if Pos('/ticket',AUID) > 0 then Result:=Get(Format('%s%s',['https://consu mer.oofd.kz/api/tickets',AUID]));    finally      FreeAndNil(AStream);      Free;    end;end; ...begin  ShowMessage(GetReceipt);end.  While looking for solution I've tried jHTTPClient, but it's seems not suitable for my case, because the requested page redirecting to another which is contain data. And I don't know how to handle it. ---------------------------------------------------------------------- bobkos · 2020-03-10 05:34 So far nobody has any ideas how to retrieve data thru https request (with redirection) on androind? Or atleast how to manage redirection with jhttpclient? ---------------------------------------------------------------------- trev · 2020-03-10 05:49 You don't mention which FPC version you are using? Anyway, a number of SSL issues were fixed in trunk (3.3.1) which fixed my issues in FreeBSD after a Linux user pointed me to trunk after it fixed his issues. ---------------------------------------------------------------------- bobkos · 2020-03-10 12:14 I'm using LAMW (Laz4Android 1.8.0 + FPC 3.0.4) ---------------------------------------------------------------------- trev · 2020-03-10 12:22 Try FPC trunk (see Installing FPC from source). ---------------------------------------------------------------------- bobkos · 2020-03-10 14:33 Ok, thank you for your advice, I'll try.