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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:48:36+00:00 2026-06-08T10:48:36+00:00

I have been searching for hours and I am still unclear on HTTPPost method.

  • 0

I have been searching for hours and I am still unclear on HTTPPost method. I have code like this…

httpclient = new DefaultHttpClient();
httppost = new HttpPost(url);
// Add your data
Log.i("ACTIVITY","PostInfo");
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
pairs.add(new BasicNameValuePair("email", stringeditemail));
httppost.setEntity(new UrlEncodedFormEntity(pairs));

Is this supposed to post the information to the given php from the designated site?
If so, What am I doing wrong that it is not posting?

This is my PHP

<?php


require('include/config.php');
 require('include/function.php');
require('classes/captcha.class.php');
require('language/' .$_SESSION['language']. '/signup.lang.php');

if ( $config['user_registrations'] == 0 ) {
$msg = $lang['signup.registration_disabled'];
session_write_close();
header('Location: index.php?msg=' .$msg);
die();
}

$email      = NULL;
if ( isset($_REQUEST['action_signup']) && $_REQUEST['action_signup'] != '' ) 
{
$email      = $filterObj->process(trim($_POST['email']));

if( $email == '' )
    $err = $lang['signup.email_empty'];
elseif ( !check_email($email) )
    $err = $lang['signup.email_invalid'];
elseif ( check_field_exists($email, 'email', 'signup') == 1 )
    $err = $lang['signup.email_exists'];

$_REQUEST['pack_id'] == '' )
    $err = $lang['signup.select_package'];

    if ( $err == '' ) {
    $email      = mysql_real_escape_string($email);

    $sql        = "insert into signup set email='" .$email. "';
    $conn->execute($sql);


    if( $config['enable_package'] == 'yes' ) {
        $pack_id = mysql_real_escape_string($_REQUEST['pack_id']);
        $sql = "select * from package where pack_id='" .$pack_id. "'";
        $rs  = $conn->execute($sql);

        } else {
            $sql = "update signup set acount_status='Inactive' where        UID='" .$userid. "' limit 1";
            $conn->execute($sql);
            session_write_close();
            header("Location: pack_ops.php?pack=$_REQUEST[pack_id]&uid=".base64_encode($userid));
            die();
        }
    }

    $sql = "INSERT INTO users_online (UID, online) VALUES (" .$userid. ", " .time(). ")";
    $conn->execute($sql);

            $_SESSION['EMAIL']      = $_REQUEST['email'];


    $ran=time().rand(1,99999999);
    $sql="update verify as v, signup as s set v.vcode='" .$ran. "', s.emailverified='no' WHERE v.UID=s.UID and v.UID='" .$userid. "'";
    $conn->execute($sql);
    STemplate::assign('vcode',$ran);

    $to         = $_SESSION['EMAIL'];
    $name       = $config['site_name'];
    $from       = $config['admin_email'];
    $rs         = $conn->execute("select * from emailinfo where email_id='verify_email'");
    $subj       = $rs->fields['email_subject'];
    $email_path     = $rs->fields['email_path'];
    $mailbody   = STemplate::fetch($email_path);
    mailing($to,$name,$from,$subj,$mailbody);

    $_SESSION['verification_sent'] = $lang['signup.verification_sent'];

    $redirect = ( isset($_SESSION['redirect']) && $_SESSION['redirect'] != '' ) ? $_SESSION['redirect'] : $config['BASE_URL'];
    $_SESSION['redirect'] = NULL;

    session_write_close();
    header('Location: ' .$redirect);
    die();
}
  }

if ( $config['enable_package'] == 'yes' ) {
    $sql = "select * from package where status = 'Active' order by price desc";
    $rs = $conn->execute($sql);
    STemplate::assign('package', $rs->getrows());
}

STemplate::assign('err',$err);
STemplate::assign('msg',$msg);
STemplate::assign('head_bottom',"homelinks.tpl");
STemplate::assign('username', $username);
STemplate::assign('email', $email);
STemplate::display('head1.tpl');
STemplate::display('err_msg.tpl');
STemplate::display('signup.tpl');
STemplate::display('footer.tpl');
STemplate::gzip_encode();
?>
  • 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-08T10:48:40+00:00Added an answer on June 8, 2026 at 10:48 am

    Try like this, you can use: HttpClient.exeucute(httpPost) and get the
    HttpResponse

    This work for me perfect.

    DefaultHttpClient client = new DefaultHttpClient();
    
        HttpPost post = new HttpPost(url);
    
        List<NameValuePair> params = new ArrayList<NameValuePair>();
    
        pairs.add(new BasicNameValuePair("email", stringeditemail));
    
        UrlEncodedFormEntity formEntity = null;
        try {
            formEntity = new UrlEncodedFormEntity(params);
    
        } catch (UnsupportedEncodingException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    
        post.setEntity(formEntity);
    
        try {
    
            HttpResponse response = client.execute(post);
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode == HttpStatus.SC_OK) {
                HttpEntity entity = response.getEntity();
                InputStream is = entity.getContent();
                return iStream_to_String(is);
            } else {
                return "Hello This is status ==> :"
                        + String.valueOf(statusCode);
            }
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    
        return null;
    
    }
    

    And create the method for the convert the stringbuilder to string

     public static String iStream_to_String(InputStream is1) {
        BufferedReader rd = new BufferedReader(new InputStreamReader(is1), 4096);
        String line;
        StringBuilder sb = new StringBuilder();
        try {
            while ((line = rd.readLine()) != null) {
                sb.append(line);
            }
            rd.close();
    
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        String contentOfMyInputStream = sb.toString();
        return contentOfMyInputStream;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been searching to a resolution to this for hours, but I still
ok this is very simple yet have been searching for 3 hours and still
I have been searching for hours on Google and Microsoft to find a code
I have been searching for a solution for this issue for multiple hours today
I have been searching for hours but I can't seem to understand why this
I have been working on this for the past couple of hours, and searching
I have been searching for several hours now how to do this, but can't
I have been searching for a couple hours for a way to accomplish this
I have been searching for hours on how to do this, and am asking
I have been searching for a few hours and cant seem to find answer

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.