Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14939] Android: POST method does not work

GitHub Issuen/a
TypeBug
PriorityLow
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 3.1.1, Release 3.1.2
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterAlexander Frischbutter
AssigneeUnknown
Created2013-06-19T18:54:16.000+0000
Updated2018-02-28T20:03:29.000+0000

Description

*Test case*
// 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. 3.2.0.v20130522185622 3.1.0.GA

Attachments

FileDateSize
Bildschirmfoto 2013-06-19 um 20.50.47.png2013-06-19T18:55:11.000+0000175411
Bildschirmfoto 2013-06-19 um 20.52.31.png2013-06-19T18:55:11.000+000044366

Comments

  1. Daniel Sefton 2013-06-19

    Would it be possible to supply the code you use in test.php as well?
  2. Shannon Hicks 2013-06-19

    Out of curiosity, try passing a javascript object instead of JSON:
       testpost : "buuhhh"
       
  3. Alexander Frischbutter 2013-06-19

    added the test.php code
  4. Shak Hossain 2013-07-31

    Closing this as invalid a code fix was recommended. If you have any further problem with this, please reopen as necessary.
  5. Alexander Frischbutter 2013-07-31

    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.
  6. Daniel Sefton 2013-07-31

    Can you try this server: http://mrtechnologybd.com/test111.php Code used there:
    	
       <?php print_r($_POST);
       print_r($_GET);?>
       
  7. Alexander Frischbutter 2013-08-01

    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.

JSON Source