<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">dears thanks for your feedback.</p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">but  after many tests i found that http_client module can't handle more than one header :\ </span><br>
</p>
<p style="margin-top:0;margin-bottom:0">i solve this issue by using EXEC module as in the following : </p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">exec_msg("curl -X POST -H \"Authorization: $var(key)\" -H \"Content-Type: application/json\" -d '{\"notification\":{\"body\": \"TEST\",\"title\":\"Hello\"},\"to\":\"user\"}' \ "https://tests.com/</span><span style="font-size: 12pt;">send/"</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> sr-users <sr-users-bounces@lists.kamailio.org> on behalf of Olle E. Johansson <oej@edvina.net><br>
<b>Sent:</b> Thursday, October 18, 2018 6:52 AM<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 class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">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/" id="LPlnk159286" class="OWAAutoLink" previewremoved="true">http://www.evaristesys.com/</a>",
<div id="LPBorder_GT_15398628626510.2949399569555238" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15398628626460.5953330326928081" role="presentation" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="ImageCell_15398628626480.4465532289063363" colspan="1" style="width: 250px; position: relative; display: table-cell; padding-right: 20px;">
<div id="LPImageContainer_15398628626480.8416988829468759" style="background-color: rgb(255, 255, 255); height: 132px; position: relative; margin: auto; display: table; width: 250px;">
<a id="LPImageAnchor_15398628626490.6348840095524586" href="http://www.evaristesys.com/" target="_blank" style="display: table-cell; text-align: center;"><img id="LPThumbnailImageID_15398628626490.41044814729673673" style="display: inline-block; max-width: 250px; max-height: 250px; height: 132px; width: 250px; border-width: 0px; vertical-align: bottom;" width="250" height="132" src="http://www.evaristesys.com/images/athens_ga_panorama.jpg"></a></div>
</td>
<td id="TextCell_15398628626490.3915099641815174" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_15398628626490.2269422646167496"></div>
<div id="LPTitle_15398628626490.08918718273629578" style="top: 0px; color: rgb(219, 98, 108); font-weight: 400; font-size: 21px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_15398628626500.9475931011149223" href="http://www.evaristesys.com/" target="_blank" style="text-decoration: none;">Introduction | Evariste Systems</a></div>
<div id="LPMetadata_15398628626510.9245537312182419" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
www.evaristesys.com</div>
<div id="LPDescription_15398628626510.5330263759806435" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
Evariste Systems is a software company specialising in open source-focused VoIP service delivery engineering for Internet Telephony Service Providers (ITSPs) and carriers.</div>
</td>
</tr>
</tbody>
</table>
</div>
<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: <a href="http://www.evaristesys.com" id="LPlnk622168" class="OWAAutoLink" previewremoved="true">
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/" id="LPlnk751084" class="OWAAutoLink" previewremoved="true">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: <a href="http://www.evaristesys.com" id="LPlnk947510" class="OWAAutoLink" previewremoved="true">
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/" id="LPlnk712427" class="OWAAutoLink" previewremoved="true">
http://www.evaristesys.com/</a>, <a href="http://www.csrpswitch.com/" id="LPlnk709306" class="OWAAutoLink" previewremoved="true">
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" id="LPlnk135011" class="OWAAutoLink" previewremoved="true">
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" id="LPlnk147881" class="OWAAutoLink" previewremoved="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>