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 7813181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:45:42+00:00 2026-06-02T04:45:42+00:00

Firstly, I’m receiving the status code 200. In the php script I’m just having

  • 0

Firstly, I’m receiving the status code 200. In the php script I’m just having the code mail me whats being sent to the server (whilst I try and debug). Using var_dump $_POST or $_REQUEST I get a blank email. If I run a foreach on $_SERVER I get some data back like HTTP_USER_AGENT : Apache-HttpClient/UNAVAILABLE (java 1.4) and CONTENT_LENGTH : 9

I don’t understand why there’s no post data? I’m new to android, I’m literally learning as I go.

HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost(dest_url);
    //httppost.setHeader("Accept", "application/json");
    //httppost.setHeader("Content-type", "application/json");

//JSONObject json = new JSONObject();

        // Add your data
        //json.put("action", "login");
        //json.put("username", "kermit");
        //json.put("password", "123456");

    ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
    //nameValuePairs.add(new BasicNameValuePair("myjson", json.toString()));
    nameValuePairs.add(new BasicNameValuePair("plswork", "hi"));
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));

    //StringEntity str_json = new StringEntity(json.toString());

    //httppost.setEntity(str_json);
    HttpResponse response;

    response = httpclient.execute(httppost);

My manifestxml has the following line;

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

These are my imports;

import java.io.IOException;
import java.util.ArrayList;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.json.JSONObject;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
  • 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-02T04:45:44+00:00Added an answer on June 2, 2026 at 4:45 am

    Most likely it has something to do with your

    httppost.setHeader("Content-type", "application/json");
    

    application/json is not a normal content type for HTTP POST form submission. Considering that you’re not really sending json but rather a standard POST entity (nameString=valueString), try changing this to

    httppost.setHeader("Content-Type", "application/x-www-form-urlencoded")
    

    and see whether this will sort your issue. Or better yet, remove it alltogether.

    I use this code in my app – and it works perfectly fine:

    HttpPost httppost = new HttpPost(SERVER_URL);
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
    nameValuePairs.add(new BasicNameValuePair("REQUEST", req));
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
    HttpResponse response = httpclient.execute(httppost);
    

    The response in this case is text/xml – but this shouldn’t matter.

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

Sidebar

Related Questions

Firstly, sorry for my flawed english and being dumb :O I just want to
Firstly here is my PHP CODE if(!isset($_POST['selection'])){ $missing['selection'] = $required['selection']; } if(empty($missing)) { post2session();
Firstly, here's my script: #!/usr/bin/python import sys, os sys.path.append('/home/username/python') sys.path.append(/home/username/python/flup) sys.path.append(/home/username/python/django) # more path
Firstly, I just want to say that the gmaps4rails gem has been fantastic. Easy
Firstly, I'd like to show you a piece of code. The code is a
Firstly, I am new to programming. I am currently having a website with 2
Firstly, let me just say that I'm very new to JSR-170 and Jackrabbit/Lucene in
firstly, pardon my pseudo-code, i think in this case it is more legible than
Firstly i have created a sequence in oracle in perl script.I get a error
Firstly - my description ;) I've got a XmlHttpRequests JSON response from the server.

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.