Android studio not comm with $_POST





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-3















I have a simple registration script, but android studio isnt properly putting data into the php script. I ran the php script on a browser, and it puts data in just fine, but android studio isnt doing it right.



Here is the registerrequest script.



public class RegisterRequest extends StringRequest {

private static final String REGISTER_REQUEST_URL = "http://192.168.*.*:80/phptesting/Register.php";
private Map<String, String> params;
public RegisterRequest(String username, String password,String isAdmin,
Response.Listener<String> listener,
Response.ErrorListener errListener){
super(Method.POST, REGISTER_REQUEST_URL,listener,errListener);
params = new HashMap<>();
params.put("username",username);
params.put("password",password);
params.put("isAdmin",isAdmin+"");
}

public Map<String, String> getparams() {
return params;
}
}


here is the create user script



public class CreateUser extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_user);
this.setTitle("Create User");
final EditText username1 = findViewById(R.id.Createusername);
final EditText password1 = findViewById(R.id.CreatePassword);
final Switch isAdmin = findViewById(R.id.isadmin);
final Button createuser = findViewById(R.id.createuserbtn);
if (getIntent().hasExtra("com.example.northlandcaps.crisis_response")){
isAdmin.setVisibility(View.GONE);
}
createuser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String username = username1.getText().toString();
final String password = password1.getText().toString();
final String isadmin = isAdmin.getText().toString();
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("Response Value: ", response);
if (response.equals("success")){
Intent intent = new Intent(CreateUser.this, MainActivity.class);
CreateUser.this.startActivity(intent);
}else{
AlertDialog.Builder builder = new AlertDialog.Builder(CreateUser.this);
builder.setMessage("Register Failed")
.setNegativeButton("Retry",null)
.create()
.show();
}
}
};Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), String.valueOf(error), Toast.LENGTH_SHORT).show();
}
};
RegisterRequest registerRequest = new RegisterRequest(username,password,isadmin,responseListener,errorListener);
RequestQueue queue = Volley.newRequestQueue(CreateUser.this);
queue.add(registerRequest);
}
});

}


here is the php script



<?php
$db_host = '192.168.*.*:3306';
$db_user = 'root';
$db_pass = '';
$db_name = 'test';
var_dump($_POST["username"]);//line 6
$con = mysqli_connect($db_host,'root',$db_pass,$db_name);
if($con){
echo "connection successful";
}
if (mysqli_connect_errno()) {
printf("Connect failed: %sn", mysqli_connect_error());
exit();
}
if(isset($_POST["isAdmin"]) && isset($_POST["username"]) && isset($_POST["password"]))
{
$username = $_POST["username"];
$password = $_POST["password"];
$isAdmin = $_POST["isAdmin"];

$statement = mysqli_prepare($con, "INSERT INTO cresidentials (username,password,isAdmin) VALUES (?, ?, ?)");
mysqli_stmt_bind_param($statement,'ssi',$username,$password,$isAdmin);
mysqli_stmt_execute($statement);

if(!$statement)
{
printf("Prepare failed: %sn", mysqli_error($con));
}

echo "success";
}
else
echo "values not set";
?>


When i run this, the app creates the retry error popup message. And the output is this;




Notice: Undefined index: username in C:xampphtdocsphptestingRegister.php on line 6 NULL connection successfulvalues not set




I believe its complaining that username isnt anything. Which is a huge problem because other variables are defined below, and I do not know if they got through if the script stopped this early
I appreciate all help, thank you










share|improve this question

























  • Not an Android guy, but obviously either you are posting nothing or you are not posting. Are you sure this is configured to use a POST and not a GET

    – RiggsFolly
    Nov 16 '18 at 13:51













  • Isn't this basically the same question as stackoverflow.com/questions/53303346/…

    – Patrick Q
    Nov 16 '18 at 13:51






  • 1





    @PatrickQ Yes and a few other, need to take pity on this guy and find him a Android person

    – RiggsFolly
    Nov 16 '18 at 13:52











  • @PatrickQ no, actually, this error only returns 1 undefined index. That question wasnt even answered properly to begin with. My actual problem is with Android studio, not PHP. Everyone on the question thought otherwise

    – Alec Harvey
    Nov 16 '18 at 13:53






  • 2





    Welp, there goes any chance of anyone here helping you. Good luck my friend.

    – Patrick Q
    Nov 16 '18 at 13:56


















-3















I have a simple registration script, but android studio isnt properly putting data into the php script. I ran the php script on a browser, and it puts data in just fine, but android studio isnt doing it right.



Here is the registerrequest script.



public class RegisterRequest extends StringRequest {

private static final String REGISTER_REQUEST_URL = "http://192.168.*.*:80/phptesting/Register.php";
private Map<String, String> params;
public RegisterRequest(String username, String password,String isAdmin,
Response.Listener<String> listener,
Response.ErrorListener errListener){
super(Method.POST, REGISTER_REQUEST_URL,listener,errListener);
params = new HashMap<>();
params.put("username",username);
params.put("password",password);
params.put("isAdmin",isAdmin+"");
}

public Map<String, String> getparams() {
return params;
}
}


here is the create user script



public class CreateUser extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_user);
this.setTitle("Create User");
final EditText username1 = findViewById(R.id.Createusername);
final EditText password1 = findViewById(R.id.CreatePassword);
final Switch isAdmin = findViewById(R.id.isadmin);
final Button createuser = findViewById(R.id.createuserbtn);
if (getIntent().hasExtra("com.example.northlandcaps.crisis_response")){
isAdmin.setVisibility(View.GONE);
}
createuser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String username = username1.getText().toString();
final String password = password1.getText().toString();
final String isadmin = isAdmin.getText().toString();
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("Response Value: ", response);
if (response.equals("success")){
Intent intent = new Intent(CreateUser.this, MainActivity.class);
CreateUser.this.startActivity(intent);
}else{
AlertDialog.Builder builder = new AlertDialog.Builder(CreateUser.this);
builder.setMessage("Register Failed")
.setNegativeButton("Retry",null)
.create()
.show();
}
}
};Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), String.valueOf(error), Toast.LENGTH_SHORT).show();
}
};
RegisterRequest registerRequest = new RegisterRequest(username,password,isadmin,responseListener,errorListener);
RequestQueue queue = Volley.newRequestQueue(CreateUser.this);
queue.add(registerRequest);
}
});

}


here is the php script



<?php
$db_host = '192.168.*.*:3306';
$db_user = 'root';
$db_pass = '';
$db_name = 'test';
var_dump($_POST["username"]);//line 6
$con = mysqli_connect($db_host,'root',$db_pass,$db_name);
if($con){
echo "connection successful";
}
if (mysqli_connect_errno()) {
printf("Connect failed: %sn", mysqli_connect_error());
exit();
}
if(isset($_POST["isAdmin"]) && isset($_POST["username"]) && isset($_POST["password"]))
{
$username = $_POST["username"];
$password = $_POST["password"];
$isAdmin = $_POST["isAdmin"];

$statement = mysqli_prepare($con, "INSERT INTO cresidentials (username,password,isAdmin) VALUES (?, ?, ?)");
mysqli_stmt_bind_param($statement,'ssi',$username,$password,$isAdmin);
mysqli_stmt_execute($statement);

if(!$statement)
{
printf("Prepare failed: %sn", mysqli_error($con));
}

echo "success";
}
else
echo "values not set";
?>


When i run this, the app creates the retry error popup message. And the output is this;




Notice: Undefined index: username in C:xampphtdocsphptestingRegister.php on line 6 NULL connection successfulvalues not set




I believe its complaining that username isnt anything. Which is a huge problem because other variables are defined below, and I do not know if they got through if the script stopped this early
I appreciate all help, thank you










share|improve this question

























  • Not an Android guy, but obviously either you are posting nothing or you are not posting. Are you sure this is configured to use a POST and not a GET

    – RiggsFolly
    Nov 16 '18 at 13:51













  • Isn't this basically the same question as stackoverflow.com/questions/53303346/…

    – Patrick Q
    Nov 16 '18 at 13:51






  • 1





    @PatrickQ Yes and a few other, need to take pity on this guy and find him a Android person

    – RiggsFolly
    Nov 16 '18 at 13:52











  • @PatrickQ no, actually, this error only returns 1 undefined index. That question wasnt even answered properly to begin with. My actual problem is with Android studio, not PHP. Everyone on the question thought otherwise

    – Alec Harvey
    Nov 16 '18 at 13:53






  • 2





    Welp, there goes any chance of anyone here helping you. Good luck my friend.

    – Patrick Q
    Nov 16 '18 at 13:56














-3












-3








-3








I have a simple registration script, but android studio isnt properly putting data into the php script. I ran the php script on a browser, and it puts data in just fine, but android studio isnt doing it right.



Here is the registerrequest script.



public class RegisterRequest extends StringRequest {

private static final String REGISTER_REQUEST_URL = "http://192.168.*.*:80/phptesting/Register.php";
private Map<String, String> params;
public RegisterRequest(String username, String password,String isAdmin,
Response.Listener<String> listener,
Response.ErrorListener errListener){
super(Method.POST, REGISTER_REQUEST_URL,listener,errListener);
params = new HashMap<>();
params.put("username",username);
params.put("password",password);
params.put("isAdmin",isAdmin+"");
}

public Map<String, String> getparams() {
return params;
}
}


here is the create user script



public class CreateUser extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_user);
this.setTitle("Create User");
final EditText username1 = findViewById(R.id.Createusername);
final EditText password1 = findViewById(R.id.CreatePassword);
final Switch isAdmin = findViewById(R.id.isadmin);
final Button createuser = findViewById(R.id.createuserbtn);
if (getIntent().hasExtra("com.example.northlandcaps.crisis_response")){
isAdmin.setVisibility(View.GONE);
}
createuser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String username = username1.getText().toString();
final String password = password1.getText().toString();
final String isadmin = isAdmin.getText().toString();
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("Response Value: ", response);
if (response.equals("success")){
Intent intent = new Intent(CreateUser.this, MainActivity.class);
CreateUser.this.startActivity(intent);
}else{
AlertDialog.Builder builder = new AlertDialog.Builder(CreateUser.this);
builder.setMessage("Register Failed")
.setNegativeButton("Retry",null)
.create()
.show();
}
}
};Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), String.valueOf(error), Toast.LENGTH_SHORT).show();
}
};
RegisterRequest registerRequest = new RegisterRequest(username,password,isadmin,responseListener,errorListener);
RequestQueue queue = Volley.newRequestQueue(CreateUser.this);
queue.add(registerRequest);
}
});

}


here is the php script



<?php
$db_host = '192.168.*.*:3306';
$db_user = 'root';
$db_pass = '';
$db_name = 'test';
var_dump($_POST["username"]);//line 6
$con = mysqli_connect($db_host,'root',$db_pass,$db_name);
if($con){
echo "connection successful";
}
if (mysqli_connect_errno()) {
printf("Connect failed: %sn", mysqli_connect_error());
exit();
}
if(isset($_POST["isAdmin"]) && isset($_POST["username"]) && isset($_POST["password"]))
{
$username = $_POST["username"];
$password = $_POST["password"];
$isAdmin = $_POST["isAdmin"];

$statement = mysqli_prepare($con, "INSERT INTO cresidentials (username,password,isAdmin) VALUES (?, ?, ?)");
mysqli_stmt_bind_param($statement,'ssi',$username,$password,$isAdmin);
mysqli_stmt_execute($statement);

if(!$statement)
{
printf("Prepare failed: %sn", mysqli_error($con));
}

echo "success";
}
else
echo "values not set";
?>


When i run this, the app creates the retry error popup message. And the output is this;




Notice: Undefined index: username in C:xampphtdocsphptestingRegister.php on line 6 NULL connection successfulvalues not set




I believe its complaining that username isnt anything. Which is a huge problem because other variables are defined below, and I do not know if they got through if the script stopped this early
I appreciate all help, thank you










share|improve this question
















I have a simple registration script, but android studio isnt properly putting data into the php script. I ran the php script on a browser, and it puts data in just fine, but android studio isnt doing it right.



Here is the registerrequest script.



public class RegisterRequest extends StringRequest {

private static final String REGISTER_REQUEST_URL = "http://192.168.*.*:80/phptesting/Register.php";
private Map<String, String> params;
public RegisterRequest(String username, String password,String isAdmin,
Response.Listener<String> listener,
Response.ErrorListener errListener){
super(Method.POST, REGISTER_REQUEST_URL,listener,errListener);
params = new HashMap<>();
params.put("username",username);
params.put("password",password);
params.put("isAdmin",isAdmin+"");
}

public Map<String, String> getparams() {
return params;
}
}


here is the create user script



public class CreateUser extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_user);
this.setTitle("Create User");
final EditText username1 = findViewById(R.id.Createusername);
final EditText password1 = findViewById(R.id.CreatePassword);
final Switch isAdmin = findViewById(R.id.isadmin);
final Button createuser = findViewById(R.id.createuserbtn);
if (getIntent().hasExtra("com.example.northlandcaps.crisis_response")){
isAdmin.setVisibility(View.GONE);
}
createuser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String username = username1.getText().toString();
final String password = password1.getText().toString();
final String isadmin = isAdmin.getText().toString();
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("Response Value: ", response);
if (response.equals("success")){
Intent intent = new Intent(CreateUser.this, MainActivity.class);
CreateUser.this.startActivity(intent);
}else{
AlertDialog.Builder builder = new AlertDialog.Builder(CreateUser.this);
builder.setMessage("Register Failed")
.setNegativeButton("Retry",null)
.create()
.show();
}
}
};Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), String.valueOf(error), Toast.LENGTH_SHORT).show();
}
};
RegisterRequest registerRequest = new RegisterRequest(username,password,isadmin,responseListener,errorListener);
RequestQueue queue = Volley.newRequestQueue(CreateUser.this);
queue.add(registerRequest);
}
});

}


here is the php script



<?php
$db_host = '192.168.*.*:3306';
$db_user = 'root';
$db_pass = '';
$db_name = 'test';
var_dump($_POST["username"]);//line 6
$con = mysqli_connect($db_host,'root',$db_pass,$db_name);
if($con){
echo "connection successful";
}
if (mysqli_connect_errno()) {
printf("Connect failed: %sn", mysqli_connect_error());
exit();
}
if(isset($_POST["isAdmin"]) && isset($_POST["username"]) && isset($_POST["password"]))
{
$username = $_POST["username"];
$password = $_POST["password"];
$isAdmin = $_POST["isAdmin"];

$statement = mysqli_prepare($con, "INSERT INTO cresidentials (username,password,isAdmin) VALUES (?, ?, ?)");
mysqli_stmt_bind_param($statement,'ssi',$username,$password,$isAdmin);
mysqli_stmt_execute($statement);

if(!$statement)
{
printf("Prepare failed: %sn", mysqli_error($con));
}

echo "success";
}
else
echo "values not set";
?>


When i run this, the app creates the retry error popup message. And the output is this;




Notice: Undefined index: username in C:xampphtdocsphptestingRegister.php on line 6 NULL connection successfulvalues not set




I believe its complaining that username isnt anything. Which is a huge problem because other variables are defined below, and I do not know if they got through if the script stopped this early
I appreciate all help, thank you







java php android android-studio






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 13:44









RiggsFolly

72.2k1868113




72.2k1868113










asked Nov 16 '18 at 13:42









Alec HarveyAlec Harvey

568




568













  • Not an Android guy, but obviously either you are posting nothing or you are not posting. Are you sure this is configured to use a POST and not a GET

    – RiggsFolly
    Nov 16 '18 at 13:51













  • Isn't this basically the same question as stackoverflow.com/questions/53303346/…

    – Patrick Q
    Nov 16 '18 at 13:51






  • 1





    @PatrickQ Yes and a few other, need to take pity on this guy and find him a Android person

    – RiggsFolly
    Nov 16 '18 at 13:52











  • @PatrickQ no, actually, this error only returns 1 undefined index. That question wasnt even answered properly to begin with. My actual problem is with Android studio, not PHP. Everyone on the question thought otherwise

    – Alec Harvey
    Nov 16 '18 at 13:53






  • 2





    Welp, there goes any chance of anyone here helping you. Good luck my friend.

    – Patrick Q
    Nov 16 '18 at 13:56



















  • Not an Android guy, but obviously either you are posting nothing or you are not posting. Are you sure this is configured to use a POST and not a GET

    – RiggsFolly
    Nov 16 '18 at 13:51













  • Isn't this basically the same question as stackoverflow.com/questions/53303346/…

    – Patrick Q
    Nov 16 '18 at 13:51






  • 1





    @PatrickQ Yes and a few other, need to take pity on this guy and find him a Android person

    – RiggsFolly
    Nov 16 '18 at 13:52











  • @PatrickQ no, actually, this error only returns 1 undefined index. That question wasnt even answered properly to begin with. My actual problem is with Android studio, not PHP. Everyone on the question thought otherwise

    – Alec Harvey
    Nov 16 '18 at 13:53






  • 2





    Welp, there goes any chance of anyone here helping you. Good luck my friend.

    – Patrick Q
    Nov 16 '18 at 13:56

















Not an Android guy, but obviously either you are posting nothing or you are not posting. Are you sure this is configured to use a POST and not a GET

– RiggsFolly
Nov 16 '18 at 13:51







Not an Android guy, but obviously either you are posting nothing or you are not posting. Are you sure this is configured to use a POST and not a GET

– RiggsFolly
Nov 16 '18 at 13:51















Isn't this basically the same question as stackoverflow.com/questions/53303346/…

– Patrick Q
Nov 16 '18 at 13:51





Isn't this basically the same question as stackoverflow.com/questions/53303346/…

– Patrick Q
Nov 16 '18 at 13:51




1




1





@PatrickQ Yes and a few other, need to take pity on this guy and find him a Android person

– RiggsFolly
Nov 16 '18 at 13:52





@PatrickQ Yes and a few other, need to take pity on this guy and find him a Android person

– RiggsFolly
Nov 16 '18 at 13:52













@PatrickQ no, actually, this error only returns 1 undefined index. That question wasnt even answered properly to begin with. My actual problem is with Android studio, not PHP. Everyone on the question thought otherwise

– Alec Harvey
Nov 16 '18 at 13:53





@PatrickQ no, actually, this error only returns 1 undefined index. That question wasnt even answered properly to begin with. My actual problem is with Android studio, not PHP. Everyone on the question thought otherwise

– Alec Harvey
Nov 16 '18 at 13:53




2




2





Welp, there goes any chance of anyone here helping you. Good luck my friend.

– Patrick Q
Nov 16 '18 at 13:56





Welp, there goes any chance of anyone here helping you. Good luck my friend.

– Patrick Q
Nov 16 '18 at 13:56












1 Answer
1






active

oldest

votes


















0














Try to get your json like that in php file



$json = json_decode(file_get_contents('php://input'), true);





share|improve this answer
























  • Will this change the incoming data from android to json? Because im sure android is sending strings, so it sounds like i need to change it to json in android

    – Alec Harvey
    Nov 16 '18 at 14:01











  • No this have only effect on how your PHP get the POST parameter, that was the solution for me when I had the same problem than you

    – Benjamin
    Nov 16 '18 at 14:05











  • Nothing happened

    – Alec Harvey
    Nov 16 '18 at 14:15











  • How did you get the param after that? Its something like $json->['NameOfParam'];

    – Benjamin
    Nov 16 '18 at 14:22













  • As an output? i got nothing. Same error

    – Alec Harvey
    Nov 16 '18 at 14:30












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339045%2fandroid-studio-not-comm-with-post%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Try to get your json like that in php file



$json = json_decode(file_get_contents('php://input'), true);





share|improve this answer
























  • Will this change the incoming data from android to json? Because im sure android is sending strings, so it sounds like i need to change it to json in android

    – Alec Harvey
    Nov 16 '18 at 14:01











  • No this have only effect on how your PHP get the POST parameter, that was the solution for me when I had the same problem than you

    – Benjamin
    Nov 16 '18 at 14:05











  • Nothing happened

    – Alec Harvey
    Nov 16 '18 at 14:15











  • How did you get the param after that? Its something like $json->['NameOfParam'];

    – Benjamin
    Nov 16 '18 at 14:22













  • As an output? i got nothing. Same error

    – Alec Harvey
    Nov 16 '18 at 14:30
















0














Try to get your json like that in php file



$json = json_decode(file_get_contents('php://input'), true);





share|improve this answer
























  • Will this change the incoming data from android to json? Because im sure android is sending strings, so it sounds like i need to change it to json in android

    – Alec Harvey
    Nov 16 '18 at 14:01











  • No this have only effect on how your PHP get the POST parameter, that was the solution for me when I had the same problem than you

    – Benjamin
    Nov 16 '18 at 14:05











  • Nothing happened

    – Alec Harvey
    Nov 16 '18 at 14:15











  • How did you get the param after that? Its something like $json->['NameOfParam'];

    – Benjamin
    Nov 16 '18 at 14:22













  • As an output? i got nothing. Same error

    – Alec Harvey
    Nov 16 '18 at 14:30














0












0








0







Try to get your json like that in php file



$json = json_decode(file_get_contents('php://input'), true);





share|improve this answer













Try to get your json like that in php file



$json = json_decode(file_get_contents('php://input'), true);






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 13:59









BenjaminBenjamin

13710




13710













  • Will this change the incoming data from android to json? Because im sure android is sending strings, so it sounds like i need to change it to json in android

    – Alec Harvey
    Nov 16 '18 at 14:01











  • No this have only effect on how your PHP get the POST parameter, that was the solution for me when I had the same problem than you

    – Benjamin
    Nov 16 '18 at 14:05











  • Nothing happened

    – Alec Harvey
    Nov 16 '18 at 14:15











  • How did you get the param after that? Its something like $json->['NameOfParam'];

    – Benjamin
    Nov 16 '18 at 14:22













  • As an output? i got nothing. Same error

    – Alec Harvey
    Nov 16 '18 at 14:30



















  • Will this change the incoming data from android to json? Because im sure android is sending strings, so it sounds like i need to change it to json in android

    – Alec Harvey
    Nov 16 '18 at 14:01











  • No this have only effect on how your PHP get the POST parameter, that was the solution for me when I had the same problem than you

    – Benjamin
    Nov 16 '18 at 14:05











  • Nothing happened

    – Alec Harvey
    Nov 16 '18 at 14:15











  • How did you get the param after that? Its something like $json->['NameOfParam'];

    – Benjamin
    Nov 16 '18 at 14:22













  • As an output? i got nothing. Same error

    – Alec Harvey
    Nov 16 '18 at 14:30

















Will this change the incoming data from android to json? Because im sure android is sending strings, so it sounds like i need to change it to json in android

– Alec Harvey
Nov 16 '18 at 14:01





Will this change the incoming data from android to json? Because im sure android is sending strings, so it sounds like i need to change it to json in android

– Alec Harvey
Nov 16 '18 at 14:01













No this have only effect on how your PHP get the POST parameter, that was the solution for me when I had the same problem than you

– Benjamin
Nov 16 '18 at 14:05





No this have only effect on how your PHP get the POST parameter, that was the solution for me when I had the same problem than you

– Benjamin
Nov 16 '18 at 14:05













Nothing happened

– Alec Harvey
Nov 16 '18 at 14:15





Nothing happened

– Alec Harvey
Nov 16 '18 at 14:15













How did you get the param after that? Its something like $json->['NameOfParam'];

– Benjamin
Nov 16 '18 at 14:22







How did you get the param after that? Its something like $json->['NameOfParam'];

– Benjamin
Nov 16 '18 at 14:22















As an output? i got nothing. Same error

– Alec Harvey
Nov 16 '18 at 14:30





As an output? i got nothing. Same error

– Alec Harvey
Nov 16 '18 at 14:30




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339045%2fandroid-studio-not-comm-with-post%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python