android - How to Extract Request Body at Server Side in PHP send by Retrofit POST request -
i using retrofit lib.
my code is
public class testpostdata { final string username; final string password; testpostdata(string username, string password) { this.username = username; this.password = password; } }
and interface is
interface test { @post("/post.php") void testmethod(@body testpostdata postbody,@query("qname") string qname,callback<response> callback); }
rest adapter
restadapter restadapter = new restadapter.builder() .setendpoint(test_url) .setloglevel(restadapter.loglevel.full) .build();
and call as
testobj.testmethod(new testpostdata("myusername", "mypassword"),"myname",new callback<response>() { ..............
at server side $_post array empty. how username , password value @ server side. name value.
i know little bit late, read request body in php can do:
<?php echo file_get_contents('php://input'); ?>
more here.
Comments
Post a Comment