Hello :)
It's my code:
public function AdAudience($name,$desc='',$emaillist='',$idgr =''){
$audience_id = '';
try {
require_once dirname(dirname(__FILE__)) . '/Google/init.php';
$user = new AdWordsUser();
$user->LogAll();
$EMAILS = array();
foreach ($emaillist as $key => $value) {
$EMAILS[]=$value;
}
$userListService = $user->GetService('AdwordsUserListService',
ADWORDS_VERSION);
$userList = new CrmBasedUserList();
$userList->id = $idgr;
$operation = new UserListOperation();
$operation->operand = $userList;
$operation->operator = 'SET';
$operations = array($operation);
$result = $userListService->mutate($operations);
$userListAdded = $result->value[0];
$audience_id = $idgr;
$userListId = $idgr;
$mutateMembersOperation = new MutateMembersOperation();
$operand = new MutateMembersOperand();
$operand->userListId = $userListId;
// You can optionally provide this field.
$operand->dataType = 'EMAIL_SHA256';
$emailHashes = array();
foreach ($EMAILS as $email) {
$emailHashes[] = hash('sha256', strtolower(trim($email)));
}
$operand->members = $emailHashes;
$mutateMembersOperation->operand = $operand;
$mutateMembersOperation->operator = 'SET';
$mutateMembersOperations = array($mutateMembersOperation);
$mutateMembersResult =
$userListService->mutateMembers($mutateMembersOperations);
} catch (Exception $e) {
printf("An error has occurred: %s\n", $e->getMessage());
}
return array(
"id"=>$audience_id,
"name"=>$name
);
}
Audience has already been created, now they need to add recipients, or e-mail
addresses. I wrote this function but unfortunately gets error:
[OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0]]
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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
---
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 [email protected].
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/7a7191e8-7af0-422a-9005-7930d9d1fdf7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.