DarkLeafyGreen
DarkLeafyGreen

Reputation: 70406

Get post data, Zend Framework

I want to fetch posted data. But I am using no form. The data is postet by a jquery script with method post and I would like to fetch it.

I know how to fetch parameters

$id = $this->getRequest ()->getParam ( 'id', null );

and form values

$message = $form->getValue ( 'message' );

however I want to access post data and not parameters or form values. Any ideas?

Upvotes: 19

Views: 68994

Answers (4)

Richard Ayotte
Richard Ayotte

Reputation: 5080

Actually, this might be more of what you're looking for.

$this->getRequest()->getRawBody();

https://framework.zend.com/manual/1.12/en/zend.controller.request.html

Upvotes: 18

dhirendra
dhirendra

Reputation: 21

Try this:

$request = $this->getRequest();
$request->getPost('field_name');

Upvotes: 2

Erdal Mersinlioglu
Erdal Mersinlioglu

Reputation: 81

Here is an other example:

$this->getRequest()->getPost()->toArray()

Upvotes: 7

DarkLeafyGreen
DarkLeafyGreen

Reputation: 70406

Here is my solution;)

$this->getRequest()->getPost('id', null);

Upvotes: 59

Related Questions