Thanks for the response tryed with double quotes and no quotes but still getting the error.any help is very much appreciated
here is my code for reference, not sure where i am going wrong. <?php require_once dirname(dirname(__FILE__)) . '/init.php'; $keywords = array(); function EstimateKeywordTrafficExample(AdWordsUser $user) { $trafficEstimatorService = $user->GetService('TrafficEstimatorService', ADWORDS_VERSION); $kfile = fopen("keywords.txt","r"); while (($line = fgets($kfile)) !== false) { //echo $line; $strng = strpos($line,'.'); if ($strng == true){ $arr = explode(".", $line, 2); $kword = $arr[0]; $mtype = $arr[1]; //echo "$kword.$mtype \n"; break; } } // fclose($kfile); $keywords[] = new keyword(); // $keywords[] = new Keyword('dentist', 'BROAD'); // $keywords[] = new Keyword("dentist hyderabad", "PHRASE"); // $keywords[] = new Keyword('dentys', 'EXACT'); $keywords[] = new Keyword($kword, $mtype); $keywordEstimateRequests = array(); foreach ($keywords as $keyword) { $keywordEstimateRequest = new KeywordEstimateRequest(); $keywordEstimateRequest->keyword = $keyword; $keywordEstimateRequests[] = $keywordEstimateRequest; } // Create ad group estimate requests. $adGroupEstimateRequest = new AdGroupEstimateRequest(); $adGroupEstimateRequest->keywordEstimateRequests = $keywordEstimateRequests; $adGroupEstimateRequest->maxCpc = new Money(1000000); // Create campaign estimate requests. $campaignEstimateRequest = new CampaignEstimateRequest(); $campaignEstimateRequest->adGroupEstimateRequests[] = $adGroupEstimateRequest; // Set targeting criteria. Only locations and languages are supported. $unitedStates = new Location(); $unitedStates->id = 20453; $campaignEstimateRequest->criteria[] = $unitedStates; $english = new Language(); $english->id = 1000; $campaignEstimateRequest->criteria[] = $english; // Create selector. $selector = new TrafficEstimatorSelector(); $selector->campaignEstimateRequests[] = $campaignEstimateRequest; // Make the get request. $result = $trafficEstimatorService->get($selector); // Display results. $keywordEstimates = $result->campaignEstimates[0]->adGroupEstimates[0]->keywordEstimates; for ($i = 0; $i < sizeof($keywordEstimates); $i++) { $keywordEstimateRequest = $keywordEstimateRequests[$i]; // Skip negative keywords, since they don't return estimates. if (!$keywordEstimateRequest->isNegative) { $keyword = $keywordEstimateRequest->keyword; $keywordEstimate = $keywordEstimates[$i]; // Print the mean of the min and max values. printf("Results for the keyword with text '%s' and match type '%s':\n", $keyword->text, $keyword->matchType); if (isset($keywordEstimate->min->clicksPerDay) && isset($keywordEstimate->max->clicksPerDay)) { $meanClicks = ($keywordEstimate->min->clicksPerDay + $keywordEstimate->max->clicksPerDay) / 2; printf(" Estimated daily clicks: %d\n", $meanClicks); } } } } // Don't run the example if the file is being included. if (__FILE__ != realpath($_SERVER['PHP_SELF'])) { return; } try { // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $user = new AdWordsUser(); // Log every SOAP XML request and response. $user->LogAll(); // Run the example. EstimateKeywordTrafficExample($user); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); } On Tuesday, April 26, 2016 at 6:28:03 PM UTC+5:30, pc wrote: > > Hi, > > i am using the php estimatorkeywordtraffic.php and reading the keyword + > matchtype from external source and i get this error. > > [RequiredError.REQUIRED @ > selector.campaignEstimateRequests[0].adGroupEstimateRequests[0].keywordEstimateRequests.keyword[0].matchType, > > RequiredError.REQUIRED @ > selector.campaignEstimateRequests[0].adGroupEstimateRequests[0].keywordEstimateRequests.keyword[0].text, > > RequiredError.REQUIRED @ > selector.campaignEstimateRequests[0].adGroupEstimateRequests[0].keywordEstimateRequests.keyword[4].matchType] > > > > $keywords[] = new Keyword('$kword', '$mtype'); > > > but if i use > > > $keywords[] = new Keyword('testing', 'EXACT'); -- this works > > > am i missing something here.. any help is appreciated > > > thanks > > > > > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/0d3a7002-e07a-459b-8c87-70cb3bf806ce%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.