A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.yiiframework.com/doc/api/2.0/yii-web-jsonparser below:

JsonParser, yii\web\JsonParser | API Documentation for Yii 2.0

Parses a HTTP request body.

                public function parse($rawBody, $contentType)
{
    // converts JSONP to JSON
    if (strpos($contentType, 'application/javascript') !== false) {
        $rawBody = preg_filter('/(^[^{]+|[^}]+$)/', '', $rawBody);
    }
    try {
        $parameters = Json::decode($rawBody, $this->asArray);
        return $parameters === null ? [] : $parameters;
    } catch (InvalidArgumentException $e) {
        if ($this->throwException) {
            throw new BadRequestHttpException('Invalid JSON data in request body: ' . $e->getMessage());
        }
        return [];
    }
}

            

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4