EDDYMENS

Published a year ago

Php://input Returns Empty

There are many reasons why php://input will return an empty result.

Check if your URL redirects somewhere else

One of the reasons php://input will return an empty result is if the URL you are sending the data to redirects to a final destination.

Use an online redirect checker [↗] to double-check if your URL redirects to some other URL.

If you find that the URL redirects, you should copy and use the final URL for your requests.

Other reasons

Here are other well documented reasons why php://input returns an empty result.

  • allow_url_fopen is disabled => enable it [↗].
  • You are applying json_decode to a malformed JSON response body => Check to be sure your JSON body is valid
  • The mime type [↗] for your request is not application/json.

Here is another article you might like 😊 Setting up HTTPS redirects on Heroku Laravel Instance