src/Utils/Request.php
/**
     * Makes CURL request with given CURL options
     *
     * @param array $curlOptions CURL options
     *
     * @return string Request's response
     * @throws RequestCURLException If the request didn't succeed
     * @throws HTTPNotFoundException If the server's reply is HTTP Not Found code (404)
     */
Makes CURL request with given CURL options
@param array $curlOptions CURL options

@return string Request's response
@throws RequestCURLException If the request didn't succeed
@throws HTTPNotFoundException If the server's reply is HTTP Not Found code (404)
Makes CURL request with given CURL options @param array $curlOptions CURL options @return string Request ' s response @throws RequestCURLException If the request didn ' t succeed @throws HTTPNotFoundException If the server ' s reply is HTTP Not Found code ( 404 )
public function request(array $curlOptions): string
    {
        if (!empty($this->defaultHeaders)) {
            if (!isset($curlOptions[CURLOPT_HTTPHEADER])) {
                $curlOptions[CURLOPT_HTTPHEADER] = [];
            }
            $curlOptions[CURLOPT_HTTPHEADER] = $this->defaultHeaders + $curlOptions[CURLOPT_HTTPHEADER];
        }
        $options = $this->defaultCURLOptions + $curlOptions;
        curl_setopt_array($this->curl, $options);
        $result = curl_exec($this->curl);
        if ($result === false) {
            throw new RequestCURLException(curl_error($this->curl), curl_errno($this->curl));
        }
        $responseCode = curl_getinfo($this->curl, CURLINFO_RESPONSE_CODE);
        if ($responseCode === self::HTTP_NOTFOUND_CODE) {
            throw new HTTPNotFoundException("404 Not Found: {$options[CURLOPT_URL]}");
        }
        return $result;
    }
public function request ( array $ curlOptions ) : string { if ( ! empty ( $ this -> defaultHeaders ) ) { if ( ! isset ( $ curlOptions [ CURLOPT_HTTPHEADER ] ) ) { $ curlOptions [ CURLOPT_HTTPHEADER ] = [ ] ; } $ curlOptions [ CURLOPT_HTTPHEADER ] = $ this -> defaultHeaders + $ curlOptions [ CURLOPT_HTTPHEADER ] ; } $ options = $ this -> defaultCURLOptions + $ curlOptions ; curl_setopt_array ( $ this -> curl , $ options ) ; $ result = curl_exec ( $ this -> curl ) ; if ( $ result === false ) { throw new RequestCURLException ( curl_error ( $ this -> curl ) , curl_errno ( $ this -> curl ) ) ; } $ responseCode = curl_getinfo ( $ this -> curl , CURLINFO_RESPONSE_CODE ) ; if ( $ responseCode === self :: HTTP_NOTFOUND_CODE ) { throw new HTTPNotFoundException ( " 404 Not Found:  { $ options [ CURLOPT_URL ] } " ) ; } return $ result ; }
Makes CURL request with given CURL options
 @param array $curlOptions CURL options
Makes CURL request with given CURL options @param array $curlOptions CURL options