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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:05:36+00:00 2026-06-14T00:05:36+00:00

Possible Duplicate: PHP php://input vs $_POST I’m using the Facebook Real-time updates API to

  • 0

Possible Duplicate:
PHP php://input vs $_POST

I’m using the Facebook Real-time updates API to subscribe to changes. The docs state:

Following a successful subscription, Facebook will proceed to call your endpoint every time that there are changes (to the chosen fields or connections). For each update, it will make an HTTP POST request.

The request will have content type of application/json and the body will comprise a JSON-encoded string containing one or more changes.

~ https://developers.facebook.com/docs/reference/api/realtime/

I tried over and over to access the POSTed data use $_POST, which was always empty. After googling for a while, i found this blog post which contained this magical line: $post_body = file_get_contents('php://input');.

I’ve never seen php://input before…. what is this? what does it do? What is Facebook doing on their side to create what I assume is a file with the JSON string in it? Why would they do this rather than sending it through $_POST?

  • 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-14T00:05:37+00:00Added an answer on June 14, 2026 at 12:05 am

    php://input is a stream wrapper over raw input body. It’s parsed by php automatically so you could get $_POST in your code. If it doesn’t – this means that it is in an unexpected format.

    In the case of facebook – they send just a json string which isn’t what PHP interpreter expects there to be (it expects it to be a key=val&key2=val&... string, and gets {key: "val",...} instead).

    That’s why you need to read and parse it manually.

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

Sidebar

Related Questions

Possible Duplicate: PHP/MySQL - Format date/time I have input field (name:day1 and varchar) to
Possible Duplicate: php validate integer Currently I'm using this method: Validate the input using
Possible Duplicate: PHP htmlentities() on input before DB insert, instead of on output For
Possible Duplicate: PHP get both array value and array key I am using Codeigniters'
Possible Duplicate: php $_POST array empty upon form submission I am trying to have
Possible Duplicate: Undefined Index when using post I'm a beginner php developer and I'm
Possible Duplicate: What are the best PHP input sanitizing functions? Let's say I have
Possible Duplicate: php $_POST array empty upon form submission I just make a simple
Possible Duplicate: Avoid resending forms on php pages Index.html <form method=post action=demo.php> <input type=text
Possible Duplicate: Parse Json in php I am working with an API that sends

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.