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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:47:49+00:00 2026-05-28T06:47:49+00:00

I submit as POST to a php page the following: {a:1} This is the

  • 0

I submit as POST to a php page the following:

{a:1}

This is the body of the request (a POST request).
In php, what do I have to do to extract that value?

var_dump($_POST); 

is not the solution, not working.

  • 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-28T06:47:49+00:00Added an answer on May 28, 2026 at 6:47 am

    To access the entity body of a POST or PUT request (or any other HTTP method):

    $entityBody = file_get_contents('php://input');
    

    Also, the STDIN constant is an already-open stream to php://input, so you can alternatively do:

    $entityBody = stream_get_contents(STDIN);
    

    From the PHP manual entry on I/O streamsdocs:

    php://input is a read-only stream that allows you to read raw data
    from the request body. In the case of POST requests, it is preferable
    to use php://input instead of $HTTP_RAW_POST_DATA as it does not
    depend on special php.ini directives. Moreover, for those cases where
    $HTTP_RAW_POST_DATA is not populated by default, it is a potentially
    less memory intensive alternative to activating
    always_populate_raw_post_data. php://input is not available with
    enctype=”multipart/form-data”.

    Specifically you’ll want to note that the php://input stream, regardless of how you access it in a web SAPI, is not seekable. This means that it can only be read once. If you’re working in an environment where large HTTP entity bodies are routinely uploaded you may wish to maintain the input in its stream form (rather than buffering it like the first example above).

    To maintain the stream resource something like this can be helpful:

    <?php
    
    function detectRequestBody() {
        $rawInput = fopen('php://input', 'r');
        $tempStream = fopen('php://temp', 'r+');
        stream_copy_to_stream($rawInput, $tempStream);
        rewind($tempStream);
    
        return $tempStream;
    }
    

    php://temp allows you to manage memory consumption because it will transparently switch to filesystem storage after a certain amount of data is stored (2M by default). This size can be manipulated in the php.ini file or by appending /maxmemory:NN, where NN is the maximum amount of data to keep in memory before using a temporary file, in bytes.

    Of course, unless you have a really good reason for seeking on the input stream, you shouldn’t need this functionality in a web application. Reading the HTTP request entity body once is usually enough — don’t keep clients waiting all day while your app figures out what to do.

    Note that php://input is not available for requests specifying a Content-Type: multipart/form-data header (enctype="multipart/form-data" in HTML forms). This results from PHP already having parsed the form data into the $_POST superglobal.

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

Sidebar

Related Questions

$page = $curl->post($baseUrl.'/submit.php', array('url'=>$address,'phase'=>'1','randkey'=>$randKey[0],'id'=>'c_1')); $exp = explode('recaptcha_image',$page); The id recaptcha_image is not found although
I have the following code: if ($_POST['submit'] == Next) { foreach($_POST['info'] as $key =>
I have a form that uses jQuery to submit an ajax post and it
For eg I have this code on the main page. <?php session_start(); $_SESSION['order']=array(); ?>
I have the following jQuery code: $('.save').submit(function(e){ var formElement = $(this); var data =
I am doing the following: <script type=text/javascript> $(function(){ $(#ipad).submit(function() { $.post(ipadcheck.php, $(#ipad).serialize(), function(data) {
I have the following handler in my page that works fine in Firefox, but
I have the following form and javascript function on my web page. This is
I have a page with the following structure: 1. Text 2. Form with SUBMIT
I am trying to understand the difference between this: if (isset($_POST['Submit'])) { //do something

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.