HTTP POST not sending parameters in a simple request?

752 views
Skip to first unread message

Maycow F

unread,
Feb 10, 2017, 7:49:38 PM2/10/17
to Tasker
Hey guys. I'm making a simple HTTP POST request using Tasker app, it's working fine but somehow it's not sending my arguments. HTTP GET is working fine. What am I doing wrong?

The only thing the server does is JSON stringify all received parameters and return them like: Text: {parameters}

HTTP GET is working:



HTTP POST works, it returns the response "text: {}" but doesn't return any parameter:


I've tested it with another server and this issue persists...

Here's a fiddle to send get and post requests to the same server and both work: 
http://jsfiddle.net/0Ljcn9d8/

I've exported my task as xml and attached it here for you to test.

Thanks in advance guys!



Post.tsk.xml

Maycow F

unread,
Feb 16, 2017, 5:39:22 PM2/16/17
to Tasker
anyone?



Yuri S5830

unread,
Apr 5, 2017, 7:51:52 AM4/5/17
to Tasker
Same problem ! Please help !

Pent

unread,
Apr 5, 2017, 9:48:07 AM4/5/17
to Tasker
What have you set MIME type to ? Something textual ?

What does the server show that it's receiving and sending back ?

Pent

Yuri S5830

unread,
Apr 6, 2017, 3:21:51 AM4/6/17
to Tasker
in PHP I have:

<?php
print_r($_POST);
?>

in Tasker I send var=val,
if mimetype is text/*, text/plain or text/html
PHP returns an empty array:

Array
(
)

else if mimetype is different than text, nothing is returned and %HTTPD is not set, but status is 200

Pent

unread,
Apr 6, 2017, 4:27:22 AM4/6/17
to Tasker
I don't know PHP, is the server receiving the correct text or not ?

Pent
Message has been deleted

Pent

unread,
Apr 6, 2017, 4:36:19 AM4/6/17
to Tasker
[deleted non-sensical post]

Pent

unread,
Apr 6, 2017, 4:38:05 AM4/6/17
to Tasker


Try setting Content-Type to

application/x-www-form-urlencoded

Pent

Yuri S5830

unread,
Apr 6, 2017, 8:49:36 AM4/6/17
to Tasker
[SOLVED]
When MIME-type is "application/x-www-form-urlencoded" posted vars can be accessed via PHP array $_POST, 
Tasker receive HTTP response code 200 (%HTTPR=200), but no content/data received (from php's "echo") and %HTTPD is not set. 

If MIME-type is "text/html" array $_POST is empty, but all posted data can be accessed via 
$allposteddata = file_get_contents('php://input');
and then parsed to vars/vals, status is 200 and content is received ok to %HTTPD

Maycow F

unread,
Apr 6, 2017, 5:55:09 PM4/6/17
to Tasker
It's not a solution actually, it's a workaround. That Tasker bug stills. In my case I use a third-part PHP server (from Google Scripts) that only gives me the tradicional $_POST and $_GET options, so I can't use  file_get_contents('php://input');.

If I set the Content Type to text or application/x-www-form-urlencoded the %HTTPD is set but $_POST is empty, if I don't set a Content Type it does the opposite, the parameters are passed to $_POST but %HTTPD is empty.

Since I hadn't received any reply here, I've asked it on StarckOverflow and got another workaround leaving Content Type empty and using an output file to get the server response.

But it is still a Tasker bug.

Yuri S5830

unread,
Apr 7, 2017, 10:00:19 AM4/7/17
to Tasker
More problems found:
I noticed that my webserver is flooded when I use Tasker's HTTP Get, HTTP Post or HTTP Head. After 2 http-requests my webserver is very very hard accessible, maybe connections are not closed, I can't figure more details. Now I tested JavaScriptlet with XMLHttpRequest and all works fine.
Reply all
Reply to author
Forward
0 new messages