<p>Yes, you can use <a href="http://www.yiiframework.com/doc/api/1.1/CHttpRequest#getRestParams-detail" rel="nofollow noreferrer">getRestParams()</a> like so: <code>$input = craft()-&gt;request-&gt;getRestParams()</code></p>

<p>A bit confusing naming there, which is why it's changing to <code>getBodyParams()</code> in Yii 2.</p>

CC BY-SA 3.0
2017-01-25T09:08:06.763Z
2017-01-25T09:08:06.763Z
Fred Carlsen
<p>Is there a way with the request service to read POSTed JSON from <code>php://input</code>?</p>

<request><https>
Read POSTed JSON data from the request body
# Read POSTed JSON data from the request body

(Asked by: username_0 on 2017-01-25)

Is there a way with the request service to read POSTed JSON from `php://input`?

**Tags:** request, https


---

## 1 answers

### Answer by username_0 on 2017-01-25. Score: 3 | Accepted answer

Yes, you can use [getRestParams()](http://www.yiiframework.com/doc/api/1.1/CHttpRequest#getRestParams-detail) like so: `$input = craft()->request->getRestParams()`

A bit confusing naming there, which is why it's changing to `getBodyParams()` in Yii 2.


---

