0

(I'm trying to debug why php is not accepting posts from remote sources, even though allow-access is set in .htaccess)

The input stream appears to be null though parameters are sent...

In an empty file:

<?php echo file_get_contents("php://input"); in file.php returns null when variables such as file.php?foo=bar are appended to the .php file...

Should this not return null, as variables/parameters are being sent?

3
  • I think some code reads php://input before you. From php.net A stream opened with php://input could only be read once; php.net/manual/en/wrappers.php.php Commented Dec 29, 2017 at 7:12
  • php://input is the very first line in php file... Commented Dec 29, 2017 at 7:13
  • 2
    I dont think GET data will show up for input, just POST. Commented Dec 29, 2017 at 7:17

1 Answer 1

2

I believe file_get_contents("php://input"); will work only with POST requests.

See php://input

For the case of query parameters, ?foo=bar would be available via $_GET

Sign up to request clarification or add additional context in comments.

1 Comment

mea culpa! of course... can you take a stab at this stackoverflow.com/questions/47978874/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.