Hi Peter. First problem: Check your permissions for this file/folder /Library/WebServer/Documents/aw_api_php_lib_2.5.1/examples/v201101/ data/tv_g_ppc_data.csv
and make your magic again :) Second problem: Your date range selection is commented out: // $selector->dateRange = new DateRange($startDate, $endDate); change it to $selector->dateRange = new DateRange($startDate, $endDate); Regards, On 6 апр, 19:08, Peter Stannett <pstannet...@gmail.com> wrote: > Hi Evgeniy > > Thank you very much for taking the time to help me. > > I have rebooted the server and the permissions change seems to have come > into effect. However I have a new set of errors! Why can't this be simple?! > Haha! > > I appreciate your help! > > Report definition with name 'ADGROUP performance report #1302102046' and id > '16413042' was added. Warning: > fopen(/Library/WebServer/Documents/aw_api_php_lib_2.5.1/examples/v201101/data/tv_g_ppc_data.csv): > failed to open stream: Permission denied in > /Library/WebServer/Documents/aw_api_php_lib_2.5.1/src/Google/Api/Ads/AdWords/Util/ReportUtils.php > on line 85 Warning: curl_setopt(): supplied argument is not a valid > File-Handle resource in > /Library/WebServer/Documents/aw_api_php_lib_2.5.1/src/Google/Api/Ads/AdWords/Util/ReportUtils.php > on line 87 ADGROUP performance report #1302102046 > > Also I do'nt understand as it is trying to retrieve data form all time, > despite my code stating only yesterday: > > <?php > > ini_set('display_errors', true); # Display error in browser (set this to > false in production envoirment) > > error_reporting (E_ALL ^ E_NOTICE); # what kind of errors do you want to > display (almost all) > > date_default_timezone_set('America/Los_Angeles'); > > /** > > * This example adds a keywords performance report. To get ad groups, run > > * GetAllAdGroups.php. To get report fields, run GetReportFields.php. > > * > > * Tags: ReportDefinitionService.mutate > > * > > * PHP version 5 > > * > > * Copyright 2011, Google Inc. All Rights Reserved. > > * > > * Licensed under the Apache License, Version 2.0 (the "License"); > > * you may not use this file except in compliance with the License. > > * You may obtain a copy of the License at > > * > > * http://www.apache.org/licenses/LICENSE-2.0 > > * > > * Unless required by applicable law or agreed to in writing, software > > * distributed under the License is distributed on an "AS IS" BASIS, > > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > > * See the License for the specific language governing permissions and > > * limitations under the License. > > * > > * @package GoogleApiAdsAdWords > > * @subpackage v201101 > > * @category WebServices > > * @copyright 2011, Google Inc. All Rights Reserved. > > * @license http://www.apache.org/licenses/LICENSE-2.0Apache License, > Version 2.0 > > * @author Eric Koleda <api.ekol...@gmail.com> > > */ > > error_reporting(E_STRICT | E_ALL); > > // You can set the include path to src directory or reference > > // AdWordsUser.php directly via require_once. > > // $path = '/path/to/aw_api_php_lib/src'; > > $path = dirname(__FILE__) . '/../../src'; > > set_include_path(get_include_path() . PATH_SEPARATOR . $path); > > require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php'; > > require_once 'Google/Api/Ads/AdWords/Util/ReportUtils.php'; > > try { > > // Get AdWordsUser from credentials in "../auth.ini" > > // relative to the AdWordsUser.php file's directory. > > $user = new AdWordsUser(); > > // Log SOAP XML request and response. > > $user->LogDefaults(); > > // Get the GetReportDefinitionService. > > $reportDefinitionService = $user->GetReportDefinitionService('v201101'); > > // $adGroupId = (float) ''; > > $startDate = '20110504'; > > $endDate = '20110504'; > > // Create selector. > > $selector = new Selector(); > > $selector->fields = array('Date','CampaignName', 'CampaignStatus', > 'AdGroupName', 'Status', 'Impressions', 'Clicks', 'Cost', > 'AveragePosition','ConversionsManyPerClick'); > > // $selector->dateRange = new DateRange($startDate, $endDate); > > // Create predicates. > > //$adGroupIdPredicate = new Predicate('AdGroupId', 'EQUALS', > array($adGroupId)); > > //$selector->predicates = array($adGroupIdPredicate); > > // Create report definition. > > $reportDefinition = new ReportDefinition(); > > $reportDefinition->reportName = 'ADGROUP performance report #' . time(); > > $reportDefinition->dateRangeType = 'CUSTOM_DATE'; > > $reportDefinition->reportType = 'ADGROUP_PERFORMANCE_REPORT'; > > $reportDefinition->downloadFormat = 'CSV'; > > $reportDefinition->selector = $selector; > > // Create operations. > > $operation = new ReportDefinitionOperation(); > > $operation->operand = $reportDefinition; > > $operation->operator = 'ADD'; > > $operations = array($operation); > > // Add report definition. > > $result = $reportDefinitionService->mutate($operations); > > // Display report definitions. > > if ($result != null) { > > foreach ($result as $reportDefinition) { > > printf("Report definition with name '%s' and id '%s' was added.\n", > > $reportDefinition->reportName, $reportDefinition->id); > > $reportDefinitionId = $reportDefinition->id; > > $fileName = 'tv_g_ppc_data.csv'; > > $path = dirname(__FILE__) . '/data/' . $fileName; > > // Download report. > > ReportUtils::DownloadReport($reportDefinitionId, $path, $user); > > printf("Report with definition id '%s' was downloaded to '%s'.\n", > > $reportDefinitionId, $path, $fileName); > > } > > } > > else { > > print "No report definitions were added.\n"; > > } > > } catch (Exception $e) { > > print $e->getMessage(); > > } -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en