Example #1
0
 /**
  * Generates the URL to use for the download request.
  * @param AdWordsUser $user the AdWordsUser to make the request for
  * @param array $options the options configured for the download
  * @return string the download URL
  */
 private static function GetUrl($user, array $options = NULL)
 {
     $server = !empty($options['server']) ? $options['server'] : $user->GetDefaultServer();
     $version = !empty($options['version']) ? $options['version'] : NULL;
     if (!isset($version) && $user->GetDefaultVersion() >= 'v201109') {
         $version = $user->GetDefaultVersion();
     }
     if (isset($server) && strpos($server, 'http') !== 0) {
         throw new ReportDownloadException('Invalid server: ' . $server);
     }
     return sprintf(self::$DOWNLOAD_URL_FORMAT, $server, $version);
 }