OK, here is the error: Fault: 1 Code: soapenv:Server.userException String: java.lang.NumberFormatException: For input string: "Array" Detail:
The syntax error was a typo in the post, the actual ID of one of my campaigns is sent. On Dec 29, 1:28 pm, AdWords API Advisor <[email protected]> wrote: > Hello Archia, > > We're going to need more information about what error you received in > order to help you. Can you provide the SOAP response with the fault > that you received? > > Looking at your code, I see a syntax error with > > $campaignIds = array(1234567]); > > due to an unneeded ']' character. You also obviously need to make sure > you're passing in a valid campaign ID for the environment you're > talking to--if it's the Sandbox then a campaign that exists in the > Sandbox, and if it's Production then a campaign that exists for that > account in Production. > > Cheers, > -Jeff Posnick, AdWords API Team > > On Dec 29, 1:17 pm, Archia <[email protected]> wrote: > > > Hi, > > > I tried to modify the PHP sample code for get_all_campaigns.php > > (http://code.google.com/p/adwords-api-php-samples/source/browse/trunk/ > > src/get_all_campaigns.php) to retrieve getCampaignStats but only got > > an error. How can I retrieve the StatsRecord[] response for a given > > campaign? > > > Here is the code I used: > > > require_once('soapclientfactory.php'); > > > # Define SOAP headers. > > $headers = $this->define_soap_headers(); //this part works fine - the > > headers are correctly set > > > # Set up service connection. > > > $namespace = 'https://adwords.google.com/api/adwords/v12'; > > $campaign_service = > > SoapClientFactory::GetClient($namespace . '/CampaignService?wsdl', > > 'wsdl'); > > $campaign_service->setHeaders($headers); > > $debug = 0; > > > $campaignIds = array(1234567]); > > > # > > $start = '2008-01-01T00:00:00Z'; > > > # > > $end = '2008-12-01T00:00:00Z'; > > > # > > $request_xml = > > '<getCampaignStats><campaignIds>'.$campaignIds.'</ > > campaignIds><startDay>'.$start.'</startDay><endDay>'.$end.'</endDay></ > > getCampaignStats>'; > > $campaign_stats = $campaign_service->call('getCampaignStats', > > $request_xml); > > $campaign_stats = $campaign_stats['getCampaignStatsReturn']; > > > if ($debug) $this->show_xml($campaign_service); > > if ($campaign_service->fault) $this->show_fault($campaign_service); > > > # Convert to a list if we get back a single object. > > if (!$campaign_stats[0]) { > > $campaign_stats = array($campaign_stats); > > > } > > > print_r($campaign_stats); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en -~----------~----~----~----~------~----~------~--~---
