src/MVC/REST/REST.php
protected function setData(&$connect, $data, $content_type)
    {
        if ($content_type == "application/json") {
            if (gettype($data) == "string") {
                json_decode($data, true);
            } else {
                $data = json_encode($data);
            }

            if (function_exists('json_last_error')) {
                $json_error = json_last_error();
                if ($json_error != JSON_ERROR_NONE) {
                    throw new Exception("JSON Error [{$json_error}] - Data: {$data}");
                }
            }
        }

        curl_setopt($connect, CURLOPT_POSTFIELDS, $data);
    }
protected function setData(&$connect, $data, $content_type)
    {
        if ($content_type == "application/json") {
            if (gettype($data) == "string") {
                json_decode($data, true);
            } else {
                $data = json_encode($data);
            }

            if (function_exists('json_last_error')) {
                $json_error = json_last_error();
                if ($json_error != JSON_ERROR_NONE) {
                    throw new Exception("JSON Error [{$json_error}] - Data: {$data}");
                }
            }
        }

        curl_setopt($connect, CURLOPT_POSTFIELDS, $data);
    }
protected function setData ( & $ connect , $ data , $ content_type ) { if ( $ content_type == "application/json" ) { if ( gettype ( $ data ) == "string" ) { json_decode ( $ data , true ) ; } else { $ data = json_encode ( $ data ) ; } if ( function_exists ( 'json_last_error' ) ) { $ json_error = json_last_error ( ) ; if ( $ json_error != JSON_ERROR_NONE ) { throw new Exception ( "JSON Error [{$json_error}] - Data: {$data}" ) ; } } } curl_setopt ( $ connect , CURLOPT_POSTFIELDS , $ data ) ; }
Sets the data request
@access protected
@param resource $connect
@param type $data
@param string $content_type
@return void
@throws \Exception
Sets the data request