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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:20:17+00:00 2026-05-20T15:20:17+00:00

Trying to get vars sent to server in url. (Script works find with manual

  • 0

Trying to get vars sent to server in url. (Script works find with manual url). The vars are picked up and show in logs but in the portion of the code I show here, the url is not calling the script: String urlString = SERVER + this.getString(R.string.login_details_url); (Btw, the php file name is spelled correctly in the constant which is called on in other working activities).

I think this may be an issue with the way the methods are set up. And there seems to be valid response from server which accounts for the activated success toast at the end. What’s missing here?

thanks

private void acctinfo(String username, String email, String password, String usertype, String over35, String userid) {                      
    Log.d(DEBUG_TAG, "AcctInfo() entered:" +  username + email + password + usertype + over35 + userid); /// These vars show up in logs
    try
    {

        sendAcctInfoToServer(this, username, email, password, usertype, over35, userid);

    }
    catch(Exception e)
    {
        e.printStackTrace();
        Log.d(DEBUG_TAG, "sendAcctInfoToServer error " , e);
        Toast.makeText(mContext, "Failed to Subit New Info", Toast.LENGTH_SHORT).show();


    }
}


private void sendAcctInfoToServer(Context context, String username, String email, String password, String usertype, String over35, String userid) throws Exception

{


    // Create a new HttpClient and Post Header
    HttpClient httpclient = new DefaultHttpClient();
    String urlString = SERVER + this.getString(R.string.login_details_url);


    urlString = urlString + "?" + USEREMAIL_VAR + "=" + email;
    urlString = urlString + "&" + PASSWORD_VAR + "=" + password;
    urlString = urlString + "&" + USERNAME_VAR + "=" + username;  
    urlString = urlString + "&" + USERID_VAR + "=" + userid;        
    urlString = urlString + "&" + USERTYPE_VAR + "=" + usertype;
    urlString = urlString + "&" + OVER35_VAR + "=" + over35;        
    urlString =  urlString+ "&change_acct=1";
    HttpPost httppost = new HttpPost(urlString);        //////This url does not get sent
    HttpResponse response =httpclient.execute(httppost);


    // Check if server response is valid
    String result = null;
    StatusLine status = response.getStatusLine();
    Log.d(DEBUG_TAG, " AcctInfo response.getStatusLine() "  + status.getStatusCode());
    if (status.getStatusCode() != HttpURLConnection.HTTP_OK) {
        result = "Invalid response from server, status code=" + status.toString();
        // Failed - so throw 
        throw new Exception("Please try again" + result); //TODO external string, remove details of error
    }
    else {
        //toast
        Toast.makeText(mContext, getString(R.string.toast_acct_info_saved), Toast.LENGTH_SHORT).show(); /// this success toast appears but no vars, of course, are passed to script
        finish();
    }
}
  • 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-20T15:20:18+00:00Added an answer on May 20, 2026 at 3:20 pm

    Try using android Uri object to build your URL.

    String baseUrl = getResources().getString(R.string.login_details_url);
    Uri.Builder builder = Uri.parse(baseUrl).buildUpon()
        .appendQueryParameter(USEREMAIL_VAR, email)
        .append...;
    HttpPost httppost = new HttpPost(builder.build());
    HttpResponse response = httpclient.execute(httppost);
    

    Maybe your problem is due to a bad character encoding.

    To log the response you can create a InputStreamReader from response.getEntity().getContent()
    I don’t know which min-sdk version uses your application, but there is an AndroidHttpClient which set lot of default values. My request failed with DefaultHttpClient but succeed with AndroidHttpClient.
    I don’t use directly AndroidHttpClient (API8), but I get the code (removing parts for curl).
    raw AndroidHttpClient sources
    Be careful you can’t use AndroidHttpClient in the main thread, you have to execute the query in a new AsyncTask or in a runnable+thread.

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

Sidebar

Related Questions

Trying to get an ASP application deployed; it worked for a while but then
I have this code - which is trying to get variables from the URL
So im trying to gain access to flash vars but i kept getting this
I'm trying to use GET variables to transfer some simple data but for some
I am trying to configure CKEditor but I get the following in my source,
I'm trying to write a longpolling server with Twisted, but I'm afraid I'm not
I'm having some trouble trying to get my script to send a file attachment
I am trying to get this form to: if any $_POST vars equals any
Trying to send array + vars with Ajax, Sending just the array worked fine...but
I'm trying get values from a GridView using the following code: foreach (GridViewRow row

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.