src/Google/AdsApi/AdWords/Reporting/v201809/ReportDownloader.php
private function makeReportRequest(array $requestOptions)
    {
        $requestOptions[RequestOptions::STREAM] = true;
        $proxy = $this->session->getConnectionSettings()->getProxyUrl();
        if (!empty($proxy)) {
            $requestOptions[RequestOptions::PROXY] = ['https' => $proxy];
        }
        if ($this->session->getConnectionSettings()->isReportingGzipEnabled()
            === true) {
            $requestOptions[RequestOptions::DECODE_CONTENT] = 'gzip';
        }

        try {
            $response = $this->httpClient->request(
                'POST',
                rtrim($this->session->getEndpoint(), '/')
                . self::$REPORT_DOWNLOAD_URL_PATH,
                $requestOptions
            );
        } catch (ClientException $e) {
            $decodedResponse = $this->apiErrorSerializer->decode(
                $e->getResponse()->getBody()->getContents(),
                'xml'
            );

            // If the decoded response is an associative array, this means there is
            // only one error and the members of the array are the fields of ApiError.
            $apiErrorList =
                AdWordsNormalizer::isOneOrMany($decodedResponse['ApiError'])
                    ? [$decodedResponse['ApiError']]
                    : $decodedResponse['ApiError'];
            $reportDownloadErrors =
                $this->apiErrorSerializer->denormalize(
                    $apiErrorList,
                    'Google\AdsApi\AdWords\Reporting\v201809\ReportDownloadError[]'
                );
            $reportDownloadException = new ApiException(
                sprintf('Details: [%s]', implode(', ', $reportDownloadErrors))
            );
            $reportDownloadException->setErrors($reportDownloadErrors);
            throw $reportDownloadException;
        } catch (ServerException $e) {
            throw new ApiException(
                'Temporary problem with the server. Please retry the request'
                . ' after a few moments'
            );
        }

        return new ReportDownloadResult($response);
    }
private function makeReportRequest(array $requestOptions)
    {
        $requestOptions[RequestOptions::STREAM] = true;
        $proxy = $this->session->getConnectionSettings()->getProxyUrl();
        if (!empty($proxy)) {
            $requestOptions[RequestOptions::PROXY] = ['https' => $proxy];
        }
        if ($this->session->getConnectionSettings()->isReportingGzipEnabled()
            === true) {
            $requestOptions[RequestOptions::DECODE_CONTENT] = 'gzip';
        }

        try {
            $response = $this->httpClient->request(
                'POST',
                rtrim($this->session->getEndpoint(), '/')
                . self::$REPORT_DOWNLOAD_URL_PATH,
                $requestOptions
            );
        } catch (ClientException $e) {
            $decodedResponse = $this->apiErrorSerializer->decode(
                $e->getResponse()->getBody()->getContents(),
                'xml'
            );

            // If the decoded response is an associative array, this means there is
            // only one error and the members of the array are the fields of ApiError.
            $apiErrorList =
                AdWordsNormalizer::isOneOrMany($decodedResponse['ApiError'])
                    ? [$decodedResponse['ApiError']]
                    : $decodedResponse['ApiError'];
            $reportDownloadErrors =
                $this->apiErrorSerializer->denormalize(
                    $apiErrorList,
                    'Google\AdsApi\AdWords\Reporting\v201809\ReportDownloadError[]'
                );
            $reportDownloadException = new ApiException(
                sprintf('Details: [%s]', implode(', ', $reportDownloadErrors))
            );
            $reportDownloadException->setErrors($reportDownloadErrors);
            throw $reportDownloadException;
        } catch (ServerException $e) {
            throw new ApiException(
                'Temporary problem with the server. Please retry the request'
                . ' after a few moments'
            );
        }

        return new ReportDownloadResult($response);
    }
private function makeReportRequest ( array $ requestOptions ) { $ requestOptions [ RequestOptions :: STREAM ] = true ; $ proxy = $ this -> session -> getConnectionSettings ( ) -> getProxyUrl ( ) ; if ( ! empty ( $ proxy ) ) { $ requestOptions [ RequestOptions :: PROXY ] = [ 'https' => $ proxy ] ; } if ( $ this -> session -> getConnectionSettings ( ) -> isReportingGzipEnabled ( ) === true ) { $ requestOptions [ RequestOptions :: DECODE_CONTENT ] = 'gzip' ; } try { $ response = $ this -> httpClient -> request ( 'POST' , rtrim ( $ this -> session -> getEndpoint ( ) , '/' ) . self :: $ REPORT_DOWNLOAD_URL_PATH , $ requestOptions ) ; } catch ( ClientException $ e ) { $ decodedResponse = $ this -> apiErrorSerializer -> decode ( $ e -> getResponse ( ) -> getBody ( ) -> getContents ( ) , 'xml' ) ; // If the decoded response is an associative array, this means there is // only one error and the members of the array are the fields of ApiError. $ apiErrorList = AdWordsNormalizer :: isOneOrMany ( $ decodedResponse [ 'ApiError' ] ) ? [ $ decodedResponse [ 'ApiError' ] ] : $ decodedResponse [ 'ApiError' ] ; $ reportDownloadErrors = $ this -> apiErrorSerializer -> denormalize ( $ apiErrorList , 'Google\AdsApi\AdWords\Reporting\v201809\ReportDownloadError[]' ) ; $ reportDownloadException = new ApiException ( sprintf ( 'Details: [%s]' , implode ( ', ' , $ reportDownloadErrors ) ) ) ; $ reportDownloadException -> setErrors ( $ reportDownloadErrors ) ; throw $ reportDownloadException ; } catch ( ServerException $ e ) { throw new ApiException ( 'Temporary problem with the server. Please retry the request' . ' after a few moments' ) ; } return new ReportDownloadResult ( $ response ) ; }
Make an HTTP request to download a report with the specified request
options.

@param array $requestOptions the options for making HTTP request via
Guzzle
@return ReportDownloadResult the report download result
@throws ApiException if there are errors during downloading reports
Make an HTTP request to download a report with the specified request options .