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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:55:47+00:00 2026-05-23T05:55:47+00:00

I am attempting to write a simple game server for an Android game using

  • 0

I am attempting to write a simple game server for an Android game using php with a mysql database.

My idea is to simply have the ‘droid application simulate a simple http post request
e.g http://www.mysite.com/missile/new.php?lat=58123456,long=-2123456,state=1

My web server is intended to then store a new missile as being launched in an mysql database from those E6 co-ords and then I intend to write another php file to allow all clients to peridoically check for missiles in flight.

I’ve tried out various bits of code I’ve found but with no 100% success.

If I type http://www.mysite.com/missile/new.php?lat=58123456,long=-2123456,state=1 into a browser bar – I get back
Array ( [launchlat] => 56123456,launchlong=2700123,state=0 ) because I’m just doing a simple

print_r($_GET);
echo '<br />';

in my php file.

However with my current code

           try {
                    String reply;
            HttpClient client = new DefaultHttpClient();  
            String postURL = "http://www.mysite.com/missile/new.php";
            HttpPost post = new HttpPost(postURL); 
                List<NameValuePair> params = new ArrayList<NameValuePair>();
                params.add(new BasicNameValuePair("launchlat", "56123456"));
                params.add(new BasicNameValuePair("launchlong", "2700123"));
                params.add(new BasicNameValuePair("state", "0"));
                UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params,HTTP.UTF_8);
                post.setEntity(ent);
                HttpResponse responsePOST = client.execute(post);  
                HttpEntity resEntity = responsePOST.getEntity();  
                if (resEntity != null) {    
                    reply = EntityUtils.toString(resEntity);
                    Log.i("RESPONSE",reply);
                }
        } catch (Exception e) {
            e.printStackTrace();
        }

I’m getting an empty array in reply.

Can anyone suggest a tweak (or completely new code to do the post and receive the reply please?

regards

Simon

  • 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-05-23T05:55:47+00:00Added an answer on May 23, 2026 at 5:55 am

    I don’t know anything about android dev, but it seems like you are using HttpPost but your php is expecting a GET.

    Change your php to look in $_POST instead of $_GET.
    If you need both GET and POST use $_REQUEST

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

Sidebar

Related Questions

I'm new to ANTLR, and I'm attempting to write a simple parser using C
I am attempting to write an application that uses libCurl to post soap requests
I have been attempting to write some routines to read RSS and ATOM feeds
I've written a web service using ASP.NET (in C#) and I'm attempting to write
I'm developing a game using XNA and C# and was attempting to avoid calling
I'm attempting to write a simple B+tree implementation (very early stages). I've got a
I am attempting to write a simple WPF learning project which creates a set
I am attempting to write some simple code in F#, and i get this
I am attempting to write a simple particle system that leverages CUDA to do
I'm attempting to write a simple query where I declare some variables and then

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.