[PHP] How to link Clients and retrieve their Campaigns? -- UNEXPECTED 'linkOp'?

56 views
Skip to first unread message

psc...@gmail.com

unread,
Sep 2, 2015, 3:00:38 PM9/2/15
to AdWords API Forum
I am currently developing an application using the AdWords API.

I followed this guide to use it in conjunction with XAMPP and PHP AdWords Library. I followed everything and edited the auth.ini file to have my credentials as such, got the RefreshToken and everything. So I do not believe it is an authorization issue. Now, to my knowledge, in order to get the campaigns from the client accounts, you must link them (stated here). So I am trying to do this, here's what my file looks like:

<?php

include
"C:\xampp\htdocs\adwords\src\Google\Api\Ads\AdWords\v201506\ManagedCustomerService.php";


LinkOperation linkOp = new LinkOperation();
ManagedCustomerLink link = new ManagedCustomerLink();
link
.setClientCustomerId("xxx");
link
.setLinkStatus(LinkStatus.PENDING);
link
.setManagerCustomerId("xxx");
linkOp
.setOperand(link);
linkOp
.setOperator(Operator.ADD);
managedCustomerService
.mutateLink(new LinkOperation[]{linkOp});


?>


replacing "xxx" with the proper IDs from the client account and my customer ID.

and upon running it from the command line, I am receiving this error:

Parse error: syntax error, unexpected 'linkOp' (T_STRING) in C:\xampp\htdocs\a
ords
\examples\AdWords\v201506\AccountManagement\LinkClientToMCC.php on line 6

Am I going about this wrong?

Umesh Dengale

unread,
Sep 2, 2015, 5:25:16 PM9/2/15
to AdWords API Forum
Hello,

You are getting above syntax error as you are using Java code inside your PHP file. Please write above code snippet in PHP. Please check out our CreateAccountExample PHP code example of the client library for reference.

Thanks,
Umesh, AdWords API Team.

Reply all
Reply to author
Forward
0 new messages