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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T09:37:42+00:00 2026-05-14T09:37:42+00:00

file_get_contents(php://input) or $HTTP_RAW_POST_DATA – which one is better to get the body of JSON

  • 0

file_get_contents("php://input") or $HTTP_RAW_POST_DATA – which one is better to get the body of JSON request?

And which request type (GET or POST) should I use to send JSON data when using client side XmlHTTPRequest?

My question was inspired from this answer:
How to post JSON to PHP with curl

Quote from that answer:

From a protocol perspective file_get_contents("php://input") is actually more correct, since you’re not really processing http multipart form data anyway.

  • 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-14T09:37:43+00:00Added an answer on May 14, 2026 at 9:37 am

    Actually php://input allows you to read raw request body.

    It is a less memory intensive alternative to $HTTP_RAW_POST_DATA and does not need any special php.ini directives.
    From Reference

    php://input is not available with enctype="multipart/form-data".

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

Sidebar

Related Questions

With php file_get_contents() i want just only the post and image. But it's get
I have a PHP script that does the following: Uses file_get_contents() to get content
When I do: class MyClass { public $copy = file_get_contents('somefile.mdown'); } I get: PHP
<?php $pro = $_GET['pro']; $pro = mysql_real_escape_string($pro); $jsonurl = index.php?z=.$pro; $json = file_get_contents($jsonurl) or
I have a problem. I have 2 php scripts, one which sends xml data
I'm building an API in PHP. One of the methods is place.new (PUT request).
I have a simple input form which contains an input type=file with name=pdf_statement. I
I'm posting a request with POST data using cURL to a PHP script here:
Is there a maximum length for the URI in the file_get_contents() function in PHP?
I'm using PHP's function file_get_contents() to fetch contents of a URL and then I

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.