<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
I tried again and it succesed  with http_client , sorry it was my false dear Alex..<br>
<br>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
Get <a href="https://aka.ms/ghei36">Outlook for Android</a></div>
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> sr-users <sr-users-bounces@lists.kamailio.org> on behalf of Alex Balashov <abalashov@evaristesys.com><br>
<b>Sent:</b> Thursday, October 18, 2018 2:47:03 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List<br>
<b>Subject:</b> Re: [SR-Users] HTTP Post with JSON</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:11pt;">
<div class="PlainText">It worked in my test.<br>
<br>
Using the exec module is a terrible idea from a performance point of view.<br>
<br>
--<br>
Sent from mobile. Apologies for brevity and errors. <br>
<br>
-----Original Message-----<br>
From: eyas barhouk <eyas37@hotmail.com><br>
To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org><br>
Sent: Thu, 18 Oct 2018 7:45 AM<br>
Subject: Re: [SR-Users] HTTP Post with JSON<br>
<br>
dears thanks for your feedback.<br>
<br>
<br>
but  after many tests i found that http_client module can't handle more than one header :\<br>
<br>
i solve this issue by using EXEC module as in the following :<br>
<br>
<br>
exec_msg("curl -X POST -H \"Authorization: $var(key)\" -H \"Content-Type: application/json\" -d '{\"notification\":{\"body\": \"TEST\",\"title\":\"Hello\"},\"to\":\"user\"}' \ "<a href="https://tests.com/send/">https://tests.com/send/</a>"<br>
<br>
<br>
<br>
<br>
<br>
________________________________<br>
From: sr-users <sr-users-bounces@lists.kamailio.org> on behalf of Olle E. Johansson <oej@edvina.net><br>
Sent: Thursday, October 18, 2018 6:52 AM<br>
To: Kamailio (SER) - Users Mailing List<br>
Subject: Re: [SR-Users] HTTP Post with JSON<br>
<br>
So much for answering before reading the full thread. Thanks Alex!<br>
<br>
/O :-)<br>
<br>
> On 17 Oct 2018, at 22:18, Alex Balashov <abalashov@evaristesys.com> wrote:<br>
><br>
> On Wed, Oct 17, 2018 at 08:01:59PM +0000, eyas barhouk wrote:<br>
><br>
>> thanks dear Alex<br>
>><br>
>><br>
>> i tried this function "http_client_query(url, [post-data], [hdrs],<br>
>> result)" but there is no example about how to use more than one header<br>
>> .<br>
>><br>
>><br>
>> if you can send me an example about how to setup the query with two<br>
>> headers like "content type" & "Authentication "<br>
><br>
> You're right, there is no example, and that's unfortunate.<br>
><br>
> I just tinkered with it, and it looks like an ordinary newline<br>
> delimiter works, but omit the last one:<br>
><br>
> In other words:<br>
><br>
> Bad --<br>
><br>
>        http_client_query("<a href="http://www.evaristesys.com/">http://www.evaristesys.com/</a>",<br>
[<a href="http://www.evaristesys.com/images/athens_ga_panorama.jpg]<http://www.evaristesys.com/">http://www.evaristesys.com/images/athens_ga_panorama.jpg]<http://www.evaristesys.com/</a>><br>
<br>
Introduction | Evariste Systems<<a href="http://www.evaristesys.com/">http://www.evaristesys.com/</a>><br>
<a href="http://www.evaristesys.com">www.evaristesys.com</a><br>
Evariste Systems is a software company specialising in open source-focused VoIP service delivery engineering for Internet Telephony Service Providers (ITSPs) and carriers.<br>
<br>
<br>
<br>
>                "a=1&b=2",<br>
>                "Content-Type: application/json\n"<br>
>                "Authentication: Basic Z29hdDpjaGVlc2U6cmVhbG0K==\n",<br>
>                "$var(result)");<br>
><br>
>        POST / HTTP/1.1<br>
>        User-Agent: kamailio (5.2.0-pre0 (x86_64/linux))<br>
>        Host: www.evaristesys.com<<a href="http://www.evaristesys.com">http://www.evaristesys.com</a>><br>
>        Accept: */*<br>
>        Content-Type: application/json<br>
>        Authentication: Basic Z29hdDpjaGVlc2U6cmVhbG0K==<br>
><br>
>        Content-Length: 7<br>
><br>
>        a=1&b=2<br>
><br>
> Good --<br>
><br>
>        http_client_query("<a href="http://www.evaristesys.com/">http://www.evaristesys.com/</a>",<br>
>                "a=1&b=2",<br>
>                "Content-Type: application/json\n"<br>
>                "Authentication: Basic Z29hdDpjaGVlc2U6cmVhbG0K==",<br>
>                "$var(result)");<br>
><br>
><br>
>        POST / HTTP/1.1<br>
>        User-Agent: kamailio (5.2.0-pre0 (x86_64/linux))<br>
>        Host: www.evaristesys.com<<a href="http://www.evaristesys.com">http://www.evaristesys.com</a>><br>
>        Accept: */*<br>
>        Content-Type: application/json<br>
>        Authentication: Basic Z29hdDpjaGVlc2U6cmVhbG0K==<br>
>        Content-Length: 7<br>
><br>
>        a=1&b=2<br>
><br>
> -- Alex<br>
><br>
> --<br>
> Alex Balashov | Principal | Evariste Systems LLC<br>
><br>
> Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)<br>
> Web: <a href="http://www.evaristesys.com/">http://www.evaristesys.com/</a>, <a href="http://www.csrpswitch.com/">
http://www.csrpswitch.com/</a><br>
><br>
> _______________________________________________<br>
> Kamailio (SER) - Users Mailing List<br>
> sr-users@lists.kamailio.org<br>
> <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
<br>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
sr-users@lists.kamailio.org<br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
sr-users@lists.kamailio.org<br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div>
</span></font>
</body>
</html>