public function send() {

		//Set default status
		$this -> response -> setStatus([

			'code' 		=> 0,
		    'protocol' 	=> '',
		    'status' 	=> '',
		    'text' 		=> ''
		]);

		$curl = curl_init();

		curl_setopt_array($curl, $this -> createOptions());

		$response = curl_exec($curl);

		if(false !== $response) {

			$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
			$headers 	 = substr($response, 0, $header_size);
			$headers 	 = $this -> parseHeaders($headers);
			$body 		 = substr($response, $header_size);
			$json 		 = @json_decode($body, true);

			$this -> response -> setHeaders($headers['headers']);
			$this -> response -> setBody($body);
			$this -> response -> setStatus($headers['status']);
			$this -> response -> setCookies($this -> parseCookies($response));
			$this -> response -> setResponse($response);

			if(true === (json_last_error() == JSON_ERROR_NONE)) {
				$this -> response -> setJson($json);
			}
		}

		$this -> response -> setInfo(curl_getinfo($curl));

		curl_close($curl);

		return $this;
	}
public function send() {

		//Set default status
		$this -> response -> setStatus([

			'code' 		=> 0,
		    'protocol' 	=> '',
		    'status' 	=> '',
		    'text' 		=> ''
		]);

		$curl = curl_init();

		curl_setopt_array($curl, $this -> createOptions());

		$response = curl_exec($curl);

		if(false !== $response) {

			$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
			$headers 	 = substr($response, 0, $header_size);
			$headers 	 = $this -> parseHeaders($headers);
			$body 		 = substr($response, $header_size);
			$json 		 = @json_decode($body, true);

			$this -> response -> setHeaders($headers['headers']);
			$this -> response -> setBody($body);
			$this -> response -> setStatus($headers['status']);
			$this -> response -> setCookies($this -> parseCookies($response));
			$this -> response -> setResponse($response);

			if(true === (json_last_error() == JSON_ERROR_NONE)) {
				$this -> response -> setJson($json);
			}
		}

		$this -> response -> setInfo(curl_getinfo($curl));

		curl_close($curl);

		return $this;
	}
public function send ( ) { //Set default status
 $ this -> response -> setStatus ( [ 'code' => 0 , 'protocol' => '' , 'status' => '' , 'text' => '' ] ) ; $ curl = curl_init ( ) ; curl_setopt_array ( $ curl , $ this -> createOptions ( ) ) ; $ response = curl_exec ( $ curl ) ; if ( false !== $ response ) { $ header_size = curl_getinfo ( $ curl , CURLINFO_HEADER_SIZE ) ; $ headers = substr ( $ response , 0 , $ header_size ) ; $ headers = $ this -> parseHeaders ( $ headers ) ; $ body = substr ( $ response , $ header_size ) ; $ json = @ json_decode ( $ body , true ) ; $ this -> response -> setHeaders ( $ headers [ 'headers' ] ) ; $ this -> response -> setBody ( $ body ) ; $ this -> response -> setStatus ( $ headers [ 'status' ] ) ; $ this -> response -> setCookies ( $ this -> parseCookies ( $ response ) ) ; $ this -> response -> setResponse ( $ response ) ; if ( true === ( json_last_error ( ) == JSON_ERROR_NONE ) ) { $ this -> response -> setJson ( $ json ) ; } } $ this -> response -> setInfo ( curl_getinfo ( $ curl ) ) ; curl_close ( $ curl ) ; return $ this ; }
Sends the request and sets all the response data
@return array
Sends the request and sets all the response data