src/classes/CCHTTP.php
public function request( $what = 'both' ) {

		/*
		 * prepare curl
		 */
		$ch = curl_init( $this->url );
		curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );  
		//curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
		curl_setopt( $ch, CURLOPT_HEADER, 1 );
		curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );

		/*
		 * prepare the headers
		 */
		$headers = array();
		foreach( $this->_headers as $key => $header ) {
			$headers[] = $key.': '.$header;
		}
		curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );

		/*
		 * post data
		 */
		if ( $this->type == static::post || $this->type == static::put ) {
			curl_setopt( $ch, CURLOPT_POST, 1 );  
			curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_data ); 
		}

		/*
		 * execute that request
		 */
		$response = curl_exec( $ch );
		if( $response === false ) {
			//echo 'Curl error: ' . curl_error($ch); 
			return false;
		}
		$header_size = curl_getinfo( $ch, CURLINFO_HEADER_SIZE );
		$header = substr( $response, 0, $header_size );
		$body = substr( $response, $header_size ); 

		// close it
		curl_close($ch);

		// format the header
		$arr_header = array();
		$header = explode( "\n", $header );
		foreach( $header as $item ) {
			$head_part = explode( ":", $item );
			if ( $this->_normalize_header_keys ) {
				$arr_header[strtolower( trim($head_part[0]) )] = trim($head_part[1]);
			}
			else {
				$arr_header[trim($head_part[0])] = trim($head_part[1]);
			}
		}

		/*
		 * return it
		 */
		if ( $what == 'both' ) {
			$return = new \stdClass;
			$return->body = $body;
			$return->header = $arr_header;
		}
		elseif ( $what == 'body' ) {
			$return = $body;
		}
		elseif ( $what == 'header' ) {
			$return = $arr_header;
		}
		else {
			throw new CCException( 'CCHTTP - param 1 in request function is invalid! Allowed are: both, header, body' );
		}
		return $return;
	}
public function request( $what = 'both' ) {

		/*
		 * prepare curl
		 */
		$ch = curl_init( $this->url );
		curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );  
		//curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
		curl_setopt( $ch, CURLOPT_HEADER, 1 );
		curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );

		/*
		 * prepare the headers
		 */
		$headers = array();
		foreach( $this->_headers as $key => $header ) {
			$headers[] = $key.': '.$header;
		}
		curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );

		/*
		 * post data
		 */
		if ( $this->type == static::post || $this->type == static::put ) {
			curl_setopt( $ch, CURLOPT_POST, 1 );  
			curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_data ); 
		}

		/*
		 * execute that request
		 */
		$response = curl_exec( $ch );
		if( $response === false ) {
			//echo 'Curl error: ' . curl_error($ch); 
			return false;
		}
		$header_size = curl_getinfo( $ch, CURLINFO_HEADER_SIZE );
		$header = substr( $response, 0, $header_size );
		$body = substr( $response, $header_size ); 

		// close it
		curl_close($ch);

		// format the header
		$arr_header = array();
		$header = explode( "\n", $header );
		foreach( $header as $item ) {
			$head_part = explode( ":", $item );
			if ( $this->_normalize_header_keys ) {
				$arr_header[strtolower( trim($head_part[0]) )] = trim($head_part[1]);
			}
			else {
				$arr_header[trim($head_part[0])] = trim($head_part[1]);
			}
		}

		/*
		 * return it
		 */
		if ( $what == 'both' ) {
			$return = new \stdClass;
			$return->body = $body;
			$return->header = $arr_header;
		}
		elseif ( $what == 'body' ) {
			$return = $body;
		}
		elseif ( $what == 'header' ) {
			$return = $arr_header;
		}
		else {
			throw new CCException( 'CCHTTP - param 1 in request function is invalid! Allowed are: both, header, body' );
		}
		return $return;
	}
public function request ( $ what = 'both' ) { /*
		 * prepare curl
		 */ $ ch = curl_init ( $ this -> url ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; //curl_setopt( $ch, CURLOPT_VERBOSE, 1 ); curl_setopt ( $ ch , CURLOPT_HEADER , 1 ) ; curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION , 1 ) ; /*
		 * prepare the headers
		 */ $ headers = array ( ) ; foreach ( $ this -> _headers as $ key => $ header ) { $ headers [ ] = $ key . ': ' . $ header ; } curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; /*
		 * post data
		 */ if ( $ this -> type == static :: post || $ this -> type == static :: put ) { curl_setopt ( $ ch , CURLOPT_POST , 1 ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ post_data ) ; } /*
		 * execute that request
		 */ $ response = curl_exec ( $ ch ) ; if ( $ response === false ) { //echo 'Curl error: ' . curl_error($ch);  return false ; } $ header_size = curl_getinfo ( $ ch , CURLINFO_HEADER_SIZE ) ; $ header = substr ( $ response , 0 , $ header_size ) ; $ body = substr ( $ response , $ header_size ) ; // close it curl_close ( $ ch ) ; // format the header $ arr_header = array ( ) ; $ header = explode ( "\n" , $ header ) ; foreach ( $ header as $ item ) { $ head_part = explode ( ":" , $ item ) ; if ( $ this -> _normalize_header_keys ) { $ arr_header [ strtolower ( trim ( $ head_part [ 0 ] ) ) ] = trim ( $ head_part [ 1 ] ) ; } else { $ arr_header [ trim ( $ head_part [ 0 ] ) ] = trim ( $ head_part [ 1 ] ) ; } } /*
		 * return it
		 */ if ( $ what == 'both' ) { $ return = new \ stdClass ; $ return -> body = $ body ; $ return -> header = $ arr_header ; } elseif ( $ what == 'body' ) { $ return = $ body ; } elseif ( $ what == 'header' ) { $ return = $ arr_header ; } else { throw new CCException ( 'CCHTTP - param 1 in request function is invalid! Allowed are: both, header, body' ) ; } return $ return ; }
and finally execute the request

returns false if the request fails

@param string	$what | both, header, body
@return mixed
and finally execute the request