Problem with keywords adding in russian language

66 views
Skip to first unread message

Michael Jones

unread,
Dec 12, 2014, 9:45:09 AM12/12/14
to adwor...@googlegroups.com
Hello!
I'm trying to add some keywords in my AdWords using PHP language. When I add some keywords in english it works fine, but in russian it shows me next error message:

Notice: Failed to load response into DOM: DOMDocument::loadXML(): Empty string supplied as input in /var/www/html/www3.repka.com.ua/sources/repka/work/adwords/AdWordsApi/source/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php on line 268 Notice: Failed to load request into DOM: DOMDocument::loadXML(): Empty string supplied as input in /var/www/html/www3.repka.com.ua/sources/repka/work/adwords/AdWordsApi/source/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php on line 275 Notice: Failed to load response into DOM: DOMDocument::loadXML(): Empty string supplied as input in /var/www/html/www3.repka.com.ua/sources/repka/work/adwords/AdWordsApi/source/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php on line 375 Notice: Failed to load response into DOM: DOMDocument::loadXML(): Empty string supplied as input in /var/www/html/www3.repka.com.ua/sources/repka/work/adwords/AdWordsApi/source/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php on line 393[SoapFault]
SOAP
-ERROR: Encoding: string '\xd2...' is not a valid utf-8 string (0)
/var/www/html/www3.repka.com.ua/sources/repka/work/adwords/AdWordsApi/source/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php:232
#0: SoapClient->__soapCall(string, array, NULL, array, array)
 
/var/www/html/www3.repka.com.ua/sources/repka/work/adwords/AdWordsApi/source/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php:232
#1: AdsSoapClient->__soapCall(string, array)
 
/var/www/html/www3.repka.com.ua/sources/repka/work/adwords/AdWordsApi/source/src/Google/Api/Ads/AdWords/v201409/AdGroupCriterionService.php:9936
#2: AdGroupCriterionService->mutate(array)
 
/var/www/html/www3.repka.com.ua/sources/repka/work/adwords/index.php:212

Bellow You can see example of my code:

$adGroupId = 1648319****;
$adGroupId
= (float)$adGroupId;
$user
= new AdWordsUser();
$user
->LogAll();


$word
= "Ключевое слово"; // error, but with $word = "Keyword"; it works fine

$adGroupCriterionService
= $user->GetService('AdGroupCriterionService', 'v201409');
// Create keyword criterion.
$keyword
= new Keyword();
$keyword
->text = $word;
$keyword
->matchType = 'BROAD';
 
// Create biddable ad group criterion.
$adGroupCriterion
= new BiddableAdGroupCriterion();
$adGroupCriterion
->adGroupId = $adGroupId;
$adGroupCriterion
->criterion = $keyword;
 
// Set additional settings (optional).
$adGroupCriterion
->userStatus = 'PAUSED';
$adGroupCriterion
->destinationUrl = 'https://repka.ua/noutbuki/asus-s301lp-s301lp-c1010h-92202/';
 
$adGroupCriteria
[] = $adGroupCriterion;
//var_dump($adGroupCriteria);
 
// Create operation.
$operation
= new AdGroupCriterionOperation();
$operation
->operand = $adGroupCriterion;
$operation
->operator = 'ADD';
$operations
[] = $operation;
 
 
$result
= $adGroupCriterionService->mutate($operations);
 
// Display results.
foreach ($result->value as $adGroupCriterion) {
 printf
("Keyword with text '%s', match type '%s', and ID '%s' was added.\n",
 $adGroupCriterion
->criterion->text,
 $adGroupCriterion
->criterion->matchType,
 $adGroupCriterion
->criterion->id);
}


I'm using php file in utf-8 encoding and my $word variable contains utf-8 string.

Tell me please how can I solve this problem? Thanks!

Danial Klimkin

unread,
Dec 15, 2014, 8:35:59 AM12/15/14
to adwor...@googlegroups.com
Hello Michael,


Please make sure you system handles utf-8 encoding correctly. Unfortunately I can't give more details as it is out of scope of the API and solely on your side.


-Danial, AdWords API Team.

...
Reply all
Reply to author
Forward
0 new messages