ISPOSTREQUEST PHP CODE EXAMPLES

I"m using the obatambeienwasirherbal.comFrameworkAppRequestHttp class to try and retrieve my POST data.

If I run $data = $this->request->getPost();, then $data will be empty.

However if I run $data = file_get_contents("php://input"); I am able khổng lồ view my JSON payload as a string.

Is there a way to grab this natively through obatambeienwasirherbal.com?

FWIW I"m testing this through a rest/V1 endpoint through Postman.This is a POST request with a chunk of (valid) JSON data in the raw data type.Bạn đã xem: Php complete form example

json http-request Share Improve this question Follow edited Mar 19 "19 at 4:01

Bạn đang xem: Ispostrequest php code examples


fmsthird 4,24844 gold badges1111 silver badges3636 bronze badges asked Mar 19 "19 at 0:30

domdambrogiadomdambrogia 29222 silver badges1414 bronze badges 1 Add a phản hồi |

1 Answer 1

Active Oldest Votes3Assuming $this->request is an instance of obatambeienwasirherbal.comFrameworkAppRequestHttp, you can use the code below to get the JSON post toàn thân.

$json = $this->request->getContent();$data = json_decode($json); Share Improve this answer Follow edited Mar 19 "19 at 17:44

Xem thêm: bộ đồ chơi tình dục


domdambrogia 29222 silver badges1414 bronze badges answered Mar 19 "19 at 0:51

fmsthirdfmsthird 4,24844 gold badges1111 silver badges3636 bronze badges Add a phản hồi |

Your Answer

Thanks for contributing an answer to lớn obatambeienwasirherbal.com Stachồng Exchange!

Please be sure khổng lồ answer the question. Provide details và nói qua your research!

But avoid

Draft savedDraft discarded

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password Submit

Post as a guest

Name Thư điện tử Required, but never shown

Post as a guest

Name Thư điện tử

Required, but never shown

Post Your Answer Discard

By clicking “Post Your Answer”, you agree lớn our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged json http-request or ask your own question.

The Overflow Blog Featured on Meta Related 4 No response from POST lớn custom REST Api route 1 Create sản phẩm using SOAP API & JSON input đầu vào 0 error while using jsonEncode in obatambeienwasirherbal.com 2.0 1 obatambeienwasirherbal.com 2: Make JSON calls inside controller 1 obatambeienwasirherbal.com 2: How can I store my original REST request in a tệp tin on the server? 0 Parsing JSON with PHP 1 Unexpected kết thúc of JSON input đầu vào after cađậy cleaned 2 How to lớn overwrite .php tệp tin of lib directory? 0 how to properly serialize / unserialize obatambeienwasirherbal.com 2 models to lớn json format Hot Network Questions more hot questions

Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy & paste this URL inlớn your RSS reader.


*