<div dir="ltr"><div><div><div>Hi Philip,<br><br>It looks like the wiki is not quite up to date with the source code, but given how fast anthm writes code I'm not surprised. :)<br><br></div>The syntax suggests you can do it. From mod_curl.c:<br>
static char *SYNTAX = "curl url [headers|json|content-type <mime-type>] [get|head|post [post_data]]";<br><br></div>So maybe something like:<br>curl <a href="http://foo.bar">http://foo.bar</a> content-type 'application/JSON'<br>
<br></div><div>Just throwing ideas out there. Please tinker and report back. :)<br><br></div><div>-MC<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 3, 2014 at 10:54 AM, Phillip Jones <span dir="ltr"><<a href="mailto:pjintheusa@gmail.com" target="_blank">pjintheusa@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi there,<div><br></div><div>Anyone out there with some experience shed some light on this?</div><div><br>
</div><div>Looking to set the <span style="font-size:12.727272033691406px;font-family:arial,sans-serif">Content</span><span style="font-size:12.727272033691406px;font-family:arial,sans-serif">-</span><span style="font-size:12.727272033691406px;font-family:arial,sans-serif">Type in mod_curl</span><span style="font-size:12.727272033691406px;font-family:arial,sans-serif"> header so that the server with recognize that the format of that data being send. For example 'application/JSON'</span></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 29, 2014 at 12:36 AM, Jeff Stark <span dir="ltr"><<a href="mailto:jstark888@gmail.com" target="_blank">jstark888@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>More info on the problem:</div><div><br></div><div>[DEBUG] mod_curl.c:166 method: post, url: http://<private IP>:8080/PushServer/api/push, content-type: (null)<br>
</div><div><br>
</div><div>So for some reason mod_curl is not setting the Content-Type header at all, which is what I think is causing my web server to complain.</div><div><br></div><div>Thanks.</div><span><font color="#888888"><div>
<br></div><div>Jeff</div></font></span></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, May 28, 2014 at 4:49 PM, Jeff Stark <span dir="ltr"><<a href="mailto:jstark888@gmail.com" target="_blank">jstark888@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,<div><br></div><div>Is there a way to set the Content-Type header when using mod_curl in a Lua script?</div><div><br></div><div>Using curl on the command line I can do the following:</div><div><br></div>
<div>
curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"field1":"val1","field2":"val2"}' <a href="http://mydomain.com/" target="_blank">http://mydomain.com/</a></div>
<div><br></div><div>And in a Lua script I can do the following:</div><div><br></div><div>local my_json = "{\"field1\":\"val1\",\"field2\":\"val2\"}"</div><div>api = freeswitch.API()</div>
<div>response_data = api:execute("curl", "<a href="http://mydomain.com/" target="_blank">http://mydomain.com/</a> post" .. my_json)</div><div><br></div><div>But I don't see a way in the freeswitch API to set the Content-Type header in the above script.</div>
<div><br></div><div>Appreciate any help or insight that can be offered.</div><div><br></div><div>Thanks.</div><span><font color="#888888"><div><br></div><div>Jeff </div></font></span></div>
</blockquote></div><br></div>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div></div>