Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
[SOLVED] HTTPS SimpleFormPost with TFPHTTPClient : Headers Issue
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Little bit...
by
Thaddy
[
Today
at 02:19:01 pm]
[SOLVED] Cannot build Uni...
by
Thausand
[
Today
at 02:18:34 pm]
I hope FreePascal can sup...
by
Warfley
[
Today
at 02:00:13 pm]
FPC Unleashed (inline var...
by
440bx
[
Today
at 01:44:13 pm]
FPC 3.2.4-rc1 available
by
Fred vS
[
Today
at 01:36:35 pm]
default pin settings, atm...
by
ccrause
[
Today
at 11:45:37 am]
TChart how setup nicestep...
by
eldonfsr
[
Today
at 05:18:14 am]
AI assisted translation o...
by
schuler
[
Today
at 03:07:59 am]
Can I get the position an...
by
wp
[
Today
at 12:23:04 am]
Translate .lfm file in a ...
by
wp
[
Today
at 12:07:11 am]
Playing video without to ...
by
n7800
[April 17, 2026, 11:51:39 pm]
Delimited text - how find...
by
n7800
[April 17, 2026, 11:28:25 pm]
overloading issues fpc3.2...
by
Martin_fr
[April 17, 2026, 10:21:07 pm]
Ann: Deinline: a de-inlin...
by
LeP
[April 17, 2026, 09:58:08 pm]
Seeking advice on setting...
by
schuler
[April 17, 2026, 03:36:28 pm]
Ann: DeCoperators
by
DomingoGP
[April 17, 2026, 03:23:39 pm]
Error: Compilation raised...
by
marcov
[April 17, 2026, 02:44:06 pm]
TLazSerial : serial port ...
by
CM630
[April 17, 2026, 09:50:34 am]
[Solved] Help needed comp...
by
landolfi
[April 17, 2026, 02:45:10 am]
DataPort or Synpase stat...
by
eldonfsr
[April 16, 2026, 11:32:18 pm]
[FPC 3.2.4, Windows] PTC ...
by
Fred vS
[April 16, 2026, 08:26:24 pm]
IDE: Property editor does...
by
dsiders
[April 16, 2026, 07:04:22 pm]
What is wrong with this c...
by
OH1KH
[April 16, 2026, 04:32:48 pm]
[work arounded]Naming dae...
by
LeP
[April 16, 2026, 03:36:10 pm]
Lazarus Bugfix Release 4....
by
Jonax
[April 16, 2026, 03:06:25 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] HTTPS SimpleFormPost with TFPHTTPClient : Headers Issue (Read 5699 times)
tudi_x
Hero Member
Posts: 532
[SOLVED] HTTPS SimpleFormPost with TFPHTTPClient : Headers Issue
«
on:
July 15, 2017, 01:43:33 pm »
hi All,
i am trying to make a POST request with custom headers.
the code is the below and attached.
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
Button1Click
(
Sender
:
TObject
)
;
var
HTTPS
:
TFPHTTPClient
;
POSTBody
:
TStringList
;
DebugURL
:
string
=
'https://requestb.in/1bqcc6f1'
;
err
:
string
;
begin
POSTBody
:
=
TStringList
.
Create
;
POSTBody
.
Append
(
'<share>'
)
;
POSTBody
.
Append
(
'</share>'
)
;
try
HTTPS
:
=
TFPHTTPClient
.
Create
(
nil
)
;
HTTPS
.
AddHeader
(
'Authorization'
,
'Bearer '
+
'TOKEN xxxxxxx'
)
;
HTTPS
.
AddHeader
(
'x-li-format'
,
'json'
)
;
HTTPS
.
AddHeader
(
'Content-Type'
,
'application/json'
)
;
err
:
=
HTTPS
.
SimpleFormPost
(
DebugURL
,
POSTBody
)
;
Memo1
.
Append
(
err
)
;
finally
FreeAndNil
(
HTTPS
)
;
FreeAndNil
(
POSTBody
)
;
end
;
end
;
it looks like the headers are not arriving to the web site - please see screen capture.
please advise what i am missing.
thank you!
using Lazarus 1.6.4 64 bit on Windows 7 and
https://indy.fulgan.com/SSL/openssl-1.0.2l-x64_86-win64.zip
«
Last Edit: July 15, 2017, 01:49:14 pm by tudi_x
»
Logged
Lazarus 2.0.2 64b on Debian LXDE 10
tudi_x
Hero Member
Posts: 532
Re: HTTPS SimpleFormPost with TFPHTTPClient : Headers Issue
«
Reply #1 on:
July 15, 2017, 01:48:50 pm »
It looks it is working with
Code: Pascal
[Select]
[+]
[-]
err
:
=
HTTPS
.
FormPost
(
DebugURL
,
POSTBody
)
;
Logged
Lazarus 2.0.2 64b on Debian LXDE 10
Leledumbo
Hero Member
Posts: 8836
Programming + Glam Metal + Tae Kwon Do = Me
Re: [SOLVED] HTTPS SimpleFormPost with TFPHTTPClient : Headers Issue
«
Reply #2 on:
July 15, 2017, 06:22:19 pm »
SimpleFormPost is a class method, it doesn't read your AddHeader at all. That method simple creates volatile instance of TFPHTTPClient and call FormPost using URL and Body parameters that you give then return the result.
Logged
Follow this if you want me to answer:
http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F
http://pascalgeek.blogspot.com
https://bitbucket.org/leledumbo
https://github.com/leledumbo
Code first, think later - Natural programmer B)
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
[SOLVED] HTTPS SimpleFormPost with TFPHTTPClient : Headers Issue
TinyPortal
© 2005-2018