* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
Thanks @GetMem, but I always get an empty string.

I found online that the CURL command is this:

Code: Pascal  [Select]
  1. --data-binary DATA  HTTP POST binary data (H)

So it should be sent as binary, no matter if it's application/json.. I don't know. But in Postman the only option that works is the 'raw' one. Using form-data, x-www-form-urlencoded or binary does not works.

So is binary or not  %)


HSL?
Perhaps you meant HLS ?

No, I just copy/paste it. And searching for HSL there is no meaningfull information, maybe it's a 'bug' in text of the emulator..
Ok, just trying  :)

I was also unable to find anything useful with regard to HSL (well, in relation with http that is)

Thanks molly =)
But I get permission to use Indy for now, I will see if it works with Indy.
2
HSL?
Perhaps you meant HLS ?

No, I just copy/paste it. And searching for HSL there is no meaningfull information, maybe it's a 'bug' in text of the emulator..
Ok, just trying  :)

I was also unable to find anything useful with regard to HSL (well, in relation with http that is)
3
@lainz

As a last try:
Code: Pascal  [Select]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   FPHTTPClient: TFPHTTPClient;
  4.   SL: TStringList;
  5.   Str: String;
  6. begin
  7.   FPHTTPClient := TFPHTTPClient.Create(nil);
  8.   try
  9.     FPHTTPClient.AllowRedirect := True;
  10.     FPHTTPClient.AddHeader('User-Agent', 'Mozilla/5.0 (compatible; fpweb)');
  11.     FPHTTPClient.AddHeader('Content-Type', 'application/json');
  12.     FPHTTPClient.AddHeader('Accept', 'application/json');
  13.     SL := TStringList.Create;
  14.     try
  15.       SL.Add('{"ConsultarVersion":{}}');
  16.       try
  17.         Str := FPHTTPClient.SimpleFormPost('http://192.168.56.1/fiscal.json', SL);
  18.         ShowMessage(Str);
  19.       except
  20.         on E: exception do
  21.           ShowMessage(E.Message);
  22.       end;
  23.     finally
  24.       SL.Free;
  25.     end;
  26.   finally
  27.     FPHTTPClient.Free;
  28.   end;
  29. end;            
4
HSL?
Perhaps you meant HLS ?

No, I just copy/paste it. And searching for HSL there is no meaningfull information, maybe it's a 'bug' in text of the emulator..
6
LCL / Re: AutoSize TMemo.Height?
« Last post by ASerge on Today at 08:38:48 pm »
Does someone know how to AutoSize the height of TMemo so that it displays all Lines?  I've tried several calculations but none of them seem to work.  I'm trying to avoid showing the scrollbars.
I have this function works:
Code: Pascal  [Select]
  1. procedure ChangeMemoHeightToFitLines(Memo: TMemo);
  2. var
  3.   TestMemo: TMemo;
  4. begin
  5.   TestMemo := TMemo.Create(nil);
  6.   try
  7.     TestMemo.Parent := Memo.Parent;
  8.     TestMemo.Width := Memo.Width;
  9.     TestMemo.Font.Assign(Memo.Font);
  10.     TestMemo.Text := Memo.Text;
  11.     TestMemo.AdjustSize;
  12.     if TestMemo.Height > Memo.Height then
  13.       Memo.Height := TestMemo.Height;
  14.   finally
  15.     TestMemo.Free;
  16.   end;
  17. end;
7
Try to add:
Code: Pascal  [Select]
  1. Client.AllowRedirect := True;

Just to be sure: you need to post a json file and the server will return a json file? Or you simple need to download a json?

Yes, I post the JSON and a JSON is returned.

Edit: No luck also with Lazarus 1.8

Info in Postman:

Code: Pascal  [Select]
  1. Access-Control-Allow-Methods →OPTIONS, POST, GET
  2. Access-Control-Allow-Origin →*
  3. Access-Control-Max-Age →86400
  4. Connection →close
  5. Content-Type →application/json; charset=UTF-8
  6. Date →Thu, 19 Apr 2018 18:33:39 GMT
  7. Server →HSL HTTP Server

HSL?
8
No luck.

Is a website like the router one, where you can see the settings, and data. And there is an 'endpoint' that is http://192.168.56.1/fiscal.json

And I tested with Postman, and it works. So there is something wrong with my lazarus maybe? I will try with 1.8, not trunk.

In Postman, I set the radio button 'Raw'.
9
Try to add:
Code: Pascal  [Select]
  1. Client.AllowRedirect := True;

Just to be sure: you need to post a json file and the server will return a json file? Or you simple need to download a json?
10
Hi @Phil, @Getmem, I try with your code, but the same with my code, it always return an empty string and StatusCode 0
Code: Pascal  [Select]
  1. ShowMessage(client.ResponseStatusCode.ToString); // 0
  2.     ShowMessage(client.ResponseHeaders.Text); // empty
  3.     ShowMessage(client.ResponseStatusText);// empty
  4.     ShowMessage(Result); // empty
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus