[TIMOB-14939] Android: POST method does not work
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | Release 3.1.1, Release 3.1.2 |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Alexander Frischbutter |
Assignee | Unknown |
Created | 2013-06-19T18:54:16.000+0000 |
Updated | 2018-02-28T20:03:29.000+0000 |
Description
*Test case*
3.2.0.v20130522185622
3.1.0.GA
// open a single window
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
var label = Ti.UI.createLabel();
win.add(label);
win.open();
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function() {
// data = JSON.parse(data);
alert(this.responseText);
}
var url = "http://ophoboo.de/fincha/test.php?testget=1";
xhr.open("POST", url);
xhr.send({
"testpost" : "buuhhh"
});
test.php
<?php
print_r($_POST);
print_r($_GET);
?>
test.php print_r the $_POST and the $_GET arrays. On the screenshot I attached you can see the android code does not send POST Data correctly.
BUT
the strengest thing is, if you send a request to this file:
http://fincha.com/test.php?testget=1
its only printing the $_POST (but it doesn't metter)
you get a correct response.
First I was thinking it might be a server problem, but the iOS App send data correctly to both servers.
Attachments
File | Date | Size |
---|---|---|
Bildschirmfoto 2013-06-19 um 20.50.47.png | 2013-06-19T18:55:11.000+0000 | 175411 |
Bildschirmfoto 2013-06-19 um 20.52.31.png | 2013-06-19T18:55:11.000+0000 | 44366 |
Would it be possible to supply the code you use in test.php as well?
Out of curiosity, try passing a javascript object instead of JSON:
added the test.php code
Closing this as invalid a code fix was recommended. If you have any further problem with this, please reopen as necessary.
Have you tested it with this file/server http://ophoboo.de/fincha/test.php?testget=1 This is very specific problem. But it is still there.
Can you try this server: http://mrtechnologybd.com/test111.php Code used there:
Yes I know it might be a server specific problem, but if you test this server "http://ophoboo.de/fincha/test.php?testget=1" with iOS it works fine. This is only an android problem. I mean maybe some header are wrong or different, if you need some more output there I can provide you a ftp access.