Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8315193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:04:37+00:00 2026-06-08T21:04:37+00:00

Need help on android. Been having this error Error Parsing data org.json.JSONException: Value <html>

  • 0

Need help on android. Been having this error Error Parsing data org.json.JSONException: Value <html> of type java.lang.String cannot be converted to JSONObject

Below is the page that is giving me the error when i run it.

public class Login extends Activity {

//URL to get User Data
private static String URL_GET = "http://10.0.2.2/android_connect/get_authentication.php";

// JSON Node names
private static final String TAG_SUCCESS = "success";
private static final String TAG_USERS = "Users";
private static final String TAG_EMAIL = "Email";
private static final String TAG_PASSWORD = "Password";

JSONParser jParser = new JSONParser();
String dbPassword = null;
// users JSONArray
JSONArray Users = null;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // setting default screen to login.xml
    setContentView(R.layout.login);

    Button btn = (Button) findViewById(R.id.btnLogin);


    // Listening to register new account link
    btn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            String password =  ((EditText) findViewById(R.id.password)).getText().toString();
            new getAuthentication().execute();

            if (password.equals(dbPassword)) {
                // Switching to Main screen
                Intent i = new Intent(getApplicationContext(), EchoSphere.class);
                startActivity(i);
            }
        }
    });
}
class getAuthentication extends AsyncTask<String, String, String>{

    @Override
    protected String doInBackground(String... params) {

        runOnUiThread(new Runnable() {
            public void run() {
                // Check for success tag
                int success;

                try {
                    String email = ((EditText) findViewById(R.id.email)).getText().toString();

                    Log.d("email:", email);

                    List<NameValuePair> params = new ArrayList<NameValuePair>();
                    params.add(new BasicNameValuePair(TAG_EMAIL, email));

                    JSONObject json = jParser.makeHttpRequest(URL_GET, "GET", params);
                    Log.d("Password:", json.toString());

                     success = json.getInt(TAG_SUCCESS);       

                    if (success == 1) {
                        Users = json.getJSONArray(TAG_USERS);
                        JSONObject c = Users.getJSONObject(0);
                        dbPassword = c.getString(TAG_PASSWORD);
                        Log.d("DBPW:", dbPassword);
                    }

                    } catch (JSONException e) {
                    e.printStackTrace();
                    }

                    }

                });
        return null;
    }

}
}

This is the PHP script, i’ve validated the PHP and it shows to be working.

<?php
// array for JSON response
$response = array();

// include db connect class
require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();

// check for post data
if (isset($_GET["Email"])) {
$email = $_GET['Email'];

// get a product from products table
$result = mysql_query("SELECT Email, Password FROM Users WHERE Email = '$email'");

if (!empty($result)) {
    // check for empty result
    if (mysql_num_rows($result) > 0) {

        $result = mysql_fetch_array($result);

        $user[] = array();
        $user["Email"] = $result["Email"];
        $user["Password"] = $result["Password"];

        // user node
        $response["Users"] = array();

        array_push($response["Users"], $user);

        // success
        $response["success"] = 1;

        // echoing JSON response
        echo json_encode($response);
    } else {
        // no product found
        $response["success"] = 0;
        $response["message"] = "No User found";

        // echo no users JSON
        echo json_encode($response);
    }
} else {
    // no product found
    $response["success"] = 0;
    $response["message"] = "No User found";

    // echo no users JSON
    echo json_encode($response);
}
} else {

// required field is missing

$response["success"] = 0;
$response["message"] = "Required field(s) is missing";

// echoing JSON response
echo json_encode($response);
}
?>

The results is as shown

{"Users":[{"0":[],"Email":"1","Password":"123"}],"success":1}

I do not know where the error lies at.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:04:39+00:00Added an answer on June 8, 2026 at 9:04 pm

    I’ve solved the error.

    Thank you all for helping.

    I added

    header('Content-type: application/json');
    

    to the php script and the application can run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need help on android =( been stuck on this for ages! My codes are
I am new to android and need help on this. I have two views
I need your help to add some insight into JNI on Android. I've been
Okay,I've been following this tutorial http://coenraets.org/blog/android-samples/androidtutorial/ Basically it gives me exactly what i need
I need help with Android. I'm trying to create a slot machine game. So,
I need help on encryption/decryption on Android application. I explain the situation. I'm actually
I need help... I got errors with my android xml... Here's the code: <?xml
I need help to find the correct command, on android, to remove the blue
Hello i am new in android and i really need help with something. I
i need some help in addition to android-layouts. For eyample: Actually I use a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.