src/Vimeo/Vimeo.php
private function _request(string $url, $curl_opts = array()): array
    {
        // Merge the options (custom options take precedence).
        $curl_opts = $this->_curl_opts + $curl_opts + $this->CURL_DEFAULTS;

        // Call the API.
        $curl = curl_init($url);
        curl_setopt_array($curl, $curl_opts);
        $response = curl_exec($curl);
        $curl_info = curl_getinfo($curl);

        if (isset($curl_info['http_code']) && $curl_info['http_code'] === 0) {
            $curl_error = curl_error($curl);
            $curl_error = !empty($curl_error) ? ' [' . $curl_error .']' : '';
            throw new VimeoRequestException('Unable to complete request.' . $curl_error);
        } elseif (!$response || !is_string($response)) {
            $curl_error = curl_error($curl);
            $curl_error = !empty($curl_error) ? ' [' . $curl_error .']' : '';
            throw new VimeoRequestException('Unable to complete request.' . $curl_error);
        }

        curl_close($curl);

        // Retrieve the info
        $header_size = $curl_info['header_size'];
        $headers = substr($response, 0, $header_size);
        $body = substr($response, $header_size);

        // Return it raw.
        return array(
            'body' => $body,
            'status' => $curl_info['http_code'],
            'headers' => self::parse_headers($headers)
        );
    }
private function _request(string $url, $curl_opts = array()): array
    {
        // Merge the options (custom options take precedence).
        $curl_opts = $this->_curl_opts + $curl_opts + $this->CURL_DEFAULTS;

        // Call the API.
        $curl = curl_init($url);
        curl_setopt_array($curl, $curl_opts);
        $response = curl_exec($curl);
        $curl_info = curl_getinfo($curl);

        if (isset($curl_info['http_code']) && $curl_info['http_code'] === 0) {
            $curl_error = curl_error($curl);
            $curl_error = !empty($curl_error) ? ' [' . $curl_error .']' : '';
            throw new VimeoRequestException('Unable to complete request.' . $curl_error);
        } elseif (!$response || !is_string($response)) {
            $curl_error = curl_error($curl);
            $curl_error = !empty($curl_error) ? ' [' . $curl_error .']' : '';
            throw new VimeoRequestException('Unable to complete request.' . $curl_error);
        }

        curl_close($curl);

        // Retrieve the info
        $header_size = $curl_info['header_size'];
        $headers = substr($response, 0, $header_size);
        $body = substr($response, $header_size);

        // Return it raw.
        return array(
            'body' => $body,
            'status' => $curl_info['http_code'],
            'headers' => self::parse_headers($headers)
        );
    }
private function _request ( string $ url , $ curl_opts = array ( ) ) : array { // Merge the options (custom options take precedence). $ curl_opts = $ this -> _curl_opts + $ curl_opts + $ this -> CURL_DEFAULTS ; // Call the API. $ curl = curl_init ( $ url ) ; curl_setopt_array ( $ curl , $ curl_opts ) ; $ response = curl_exec ( $ curl ) ; $ curl_info = curl_getinfo ( $ curl ) ; if ( isset ( $ curl_info [ 'http_code' ] ) && $ curl_info [ 'http_code' ] === 0 ) { $ curl_error = curl_error ( $ curl ) ; $ curl_error = ! empty ( $ curl_error ) ? ' [' . $ curl_error . ']' : '' ; throw new VimeoRequestException ( 'Unable to complete request.' . $ curl_error ) ; } elseif ( ! $ response || ! is_string ( $ response ) ) { $ curl_error = curl_error ( $ curl ) ; $ curl_error = ! empty ( $ curl_error ) ? ' [' . $ curl_error . ']' : '' ; throw new VimeoRequestException ( 'Unable to complete request.' . $ curl_error ) ; } curl_close ( $ curl ) ; // Retrieve the info $ header_size = $ curl_info [ 'header_size' ] ; $ headers = substr ( $ response , 0 , $ header_size ) ; $ body = substr ( $ response , $ header_size ) ; // Return it raw. return array ( 'body' => $ body , 'status' => $ curl_info [ 'http_code' ] , 'headers' => self :: parse_headers ( $ headers ) ) ; }
Internal function to handle requests, both authenticated and by the upload function.

@param string $url
@param array $curl_opts
@return array
@throws VimeoRequestException
Internal function to handle requests both authenticated and by the upload function .