Apache goes down when I'm trying to add keywords to a AdGroup

2010-12-06 Thread Minor
Hi.

I've tried to google anything about that but didn't find anything.
I've created a script that successfully gets and creates a campaign/
adgroup.
But when I'm trying to add one or more keywords to adgroup, windows
says that appache would be closed due to error.

I'm using Win7+Apache/2.2.4 (Win32) + PHP/5.3.1
And I'm using API 201008
Here's a chunk of code that causes an error.


foreach ($keywords as $index = $keyword)
{
// Create keyword.
$keyword = new Keyword();
$keyword-text = $keyword;
$keyword-matchType = 'BROAD';

// Create biddable ad group criterion.
$keywordAdGroupCriterion[$index] = new
BiddableAdGroupCriterion();
$keywordAdGroupCriterion[$index]-adGroupId = $adGroupId;
$keywordAdGroupCriterion[$index]-criterion = $keyword;

// Create operations.
$keywordAdGroupCriterionOperation[$index] = new
AdGroupCriterionOperation();
$keywordAdGroupCriterionOperation[$index]-operand =
$keywordAdGroupCriterion[$index];
$keywordAdGroupCriterionOperation[$index]-operator =
'ADD';

$operations[$index] =
$keywordAdGroupCriterionOperation[$index];
}

// Add ad group criteria.
if(!empty($operations))
$result = $adGroupCriterionService-
mutate($operations); // -- this line causes an error


I'll try to find out where's the problem in the mutate function. And
I'll be very thankful if you'll help me with this.
Please ask if you need some additional info.

Thanks,
Alex

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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


Re: Apache goes down when I'm trying to add keywords to a AdGroup

2010-12-06 Thread Minor
Thanks for attention, but I've already found a stupid thing I've wrote
there. I'm putting $keyword object as the text for $keyword object
that makes recursion.
So the solution is to use different name for $keyword variable that
contain keyword text.
Like:
 foreach ($keywords as $index = $keyphrase)
 {
 // Create keyword.
 $keyword = new Keyword();
 $keyword-text = $keyphrase;
 $keyword-matchType = 'BROAD';
...

Hope that'll help to somebody =)
Alex.



On 4 дек, 19:05, Minor gmino...@gmail.com wrote:
 Hi.

 I've tried to google anything about that but didn't find anything.
 I've created a script that successfully gets and creates a campaign/
 adgroup.
 But when I'm trying to add one or more keywords to adgroup, windows
 says that appache would be closed due to error.

 I'm using Win7+Apache/2.2.4 (Win32) + PHP/5.3.1
 And I'm using API 201008
 Here's a chunk of code that causes an error.

 
 foreach ($keywords as $index = $keyword)
         {
             // Create keyword.
             $keyword = new Keyword();
             $keyword-text = $keyword;
             $keyword-matchType = 'BROAD';

             // Create biddable ad group criterion.
             $keywordAdGroupCriterion[$index] = new
 BiddableAdGroupCriterion();
             $keywordAdGroupCriterion[$index]-adGroupId = $adGroupId;
             $keywordAdGroupCriterion[$index]-criterion = $keyword;

             // Create operations.
             $keywordAdGroupCriterionOperation[$index] = new
 AdGroupCriterionOperation();
             $keywordAdGroupCriterionOperation[$index]-operand =
 $keywordAdGroupCriterion[$index];
             $keywordAdGroupCriterionOperation[$index]-operator =
 'ADD';

             $operations[$index] =
 $keywordAdGroupCriterionOperation[$index];
         }

         // Add ad group criteria.
         if(!empty($operations))
             $result = $adGroupCriterionService-mutate($operations); // -- 
 this line causes an error

 

 I'll try to find out where's the problem in the mutate function. And
 I'll be very thankful if you'll help me with this.
 Please ask if you need some additional info.

 Thanks,
 Alex

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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