Created
May 12, 2014 08:22
-
-
Save dmitry-udod/ec6b9305979ab481a2a6 to your computer and use it in GitHub Desktop.
ReactPHP process POST request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$http->on('request', function ($request, $response) { | |
$sink = new React\Stream\BufferedSink(); | |
$request->pipe($sink); | |
$sink->promise()->then(function ($requestBody) use ($response) { | |
parse_str($requestBody, $requestData); | |
var_dump($requestData); | |
$response->writeHead(); | |
$response->end("Hi, thanks man.\n"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment