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

  • SEARCH
  • Home
  • 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 8453351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:44:59+00:00 2026-06-10T11:44:59+00:00

I am trying to return a string from my php file to my android

  • 0

I am trying to return a string from my php file to my android application. The php file is not in json form. jsonobject just returns error 07-28 20:10:56.538: W/System.err(2936): org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject I have also tried SAXParser, but i understand that that is for xml files only. When I use a StringBuilder like such

public static String iStream_to_String(InputStream is1) {
    BufferedReader rd = new BufferedReader(new InputStreamReader(is1), 8192);
    String line;
    StringBuilder sb = new StringBuilder();
    String longitudecord = "";
    try {
        while ((line = rd.readLine()) != null) {
            sb.append(line+"\n");

        }
//          rd.close();

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }



    String contentOfMyInputStream = sb.toString();
    return contentOfMyInputStream;
}

I get a response much like this one <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
the response That I want to get is a simple string returning a given error file. is there any possible way to do such a simple task without json?

also i want to add the file type of the php is application/x-httpd-php if that helps or not.

  • 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-10T11:45:01+00:00Added an answer on June 10, 2026 at 11:45 am

    I was just calling the php wrong:/

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

Sidebar

Related Questions

I'm trying to retrieve data from a php file named return that just contains
trying to send Arabic text from android to PHP file using the code below
I am trying to return a string from the SalesPerson object with fullNameMethod to
I'm trying to return a string from a function. Which basically adds some chars
I'm trying to upload an image from android to a PHP server by using
I've been trying to return special characters from an AJAX request to a PHP
I am trying to upload a mp3 file from my android device(2.3.3) but failing.
I'm tring to use the NSURL class's parameterString message to return the string from
Trying to override a tostring in one of my classes. return string.Format(@ name =
I'm trying to return a certain part of a string. I've looked at substr

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.