Skip to content

[Q] How to get php://input? #627

Answered by wolfy-j
sinbadxiii asked this question in Q&A
Discussion options

You must be logged in to vote

It is not possible to get raw data from RoadRunner using the classic method of PHP://input. Under the roadrunner, input is shared between worker executions and not available for direct read.

But, you don't need to do that since you have an instance of PSR-7 request: https://www.php-fig.org/psr/psr-7/#13-streams

Use getBody() stream to read the raw content of the body.

$raw = (string)$req->getBody();

Doesn't Phalcon has Request/Response abstraction? I would much rather recommend you hook into such DTO instead of emulating a classic PHP environment (which is an interesting idea, however).

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sinbadxiii
Comment options

Answer selected by sinbadxiii
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
R-question Question
2 participants