HttpClientResponse.php
public static function instance_from_curl($ch, $body) {
		$transfer_info = curl_getinfo($ch);
		$statuscode = (!empty($transfer_info['http_code'])) ? (int)$transfer_info['http_code'] : 404;
		$errors = [];

		$err = static::decode_error_code(curl_errno($ch));
		if ($err !== 'SUCCESS') {
			$errors[] = $err;
		}

		$mime = (!empty($transfer_info['content_type'])) ? $transfer_info['content_type'] : 'text/plain';

		return new HttpClientResponse($statuscode, $mime, $body, $errors);
	}
public static function instance_from_curl($ch, $body) {
		$transfer_info = curl_getinfo($ch);
		$statuscode = (!empty($transfer_info['http_code'])) ? (int)$transfer_info['http_code'] : 404;
		$errors = [];

		$err = static::decode_error_code(curl_errno($ch));
		if ($err !== 'SUCCESS') {
			$errors[] = $err;
		}

		$mime = (!empty($transfer_info['content_type'])) ? $transfer_info['content_type'] : 'text/plain';

		return new HttpClientResponse($statuscode, $mime, $body, $errors);
	}
public static function instance_from_curl ( $ ch , $ body ) { $ transfer_info = curl_getinfo ( $ ch ) ; $ statuscode = ( ! empty ( $ transfer_info [ 'http_code' ] ) ) ? ( int ) $ transfer_info [ 'http_code' ] : 404 ; $ errors = [ ] ; $ err = static :: decode_error_code ( curl_errno ( $ ch ) ) ; if ( $ err !== 'SUCCESS' ) { $ errors [ ] = $ err ; } $ mime = ( ! empty ( $ transfer_info [ 'content_type' ] ) ) ? $ transfer_info [ 'content_type' ] : 'text/plain' ; return new HttpClientResponse ( $ statuscode , $ mime , $ body , $ errors ) ; }
Create an instance from a curl handle and body.

@param resource $ch An active curl handle.
@param string $body The returned body.
@return HttpClientResponse A response object.
Create an instance from a curl handle and body .