Yii : How to get raw POST

public function actionIndex() {
		//print_r($_POST);
		if (Yii::app()->request->isAjaxRequest) {
			$postdata = file_get_contents("php://input");
			if ($postdata) {
        		// do something
         		$outObj = array('success' => true);
      		echo CJSON::encode($outObj);
			}
		}
}

“php://input allows you to read raw POST data.
It is a less memory intensive alternative to $HTTP_RAW_POST_DATA and does not need any special php.ini directives.”
php://
took it from StackOverflow

Advertisements
Tagged , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: