Example #1
0
/**
 * Gets decoded JSON HTTP raw request body
 *
 * @return string
 */
PHP_METHOD(Phalcon_Http_Request, getJsonRawBody){

	zval *raw_body;

	PHALCON_MM_GROW();

	PHALCON_INIT_VAR(raw_body);
	phalcon_call_method(raw_body, this_ptr, "getrawbody");
	if (Z_TYPE_P(raw_body) == IS_STRING) {
		phalcon_json_decode(return_value, raw_body, 0 TSRMLS_CC);
		RETURN_MM();
	}
	
	PHALCON_MM_RESTORE();
}
Example #2
0
/**
 * Gets decoded JSON HTTP raw request body
 *
 * @param bool $assoc
 * @return string
 */
PHP_METHOD(Phalcon_Http_Request, getJsonRawBody)
{
	zval raw_body = {}, *assoc = NULL;
	int ac = 0;

	phalcon_fetch_params(0, 0, 1, &assoc);

	if (assoc && zend_is_true(assoc)) {
		ac = 1;
	}

	PHALCON_CALL_METHODW(&raw_body, getThis(), "getrawbody");
	if (Z_TYPE(raw_body) == IS_STRING) {
		RETURN_ON_FAILURE(phalcon_json_decode(return_value, &raw_body, ac));
		return;
	}
}