Beginner's question: PHP & AdSense API

80 views
Skip to first unread message

Adrien Hingert

unread,
Aug 21, 2023, 5:04:39 AM8/21/23
to AdSense API Forum
Hi, I'm trying to write a PHP script which will allow a server to pull AdSense data when it's run. I managed to get this working via Google Sheets & App Script, but I'm having trouble even understanding how to authenticate when doing so via PHP.

Could somebody point me to a step-by-step process which will allow me to authenticate my server-side script and pull a basic dataset from AdSense?

Some questions I have:
- What credentials do I need? (API Keys, OAuth 2.0 Client IDs, Service Accounts...)
- Where do I get these? (here?)
- Any specific configuration I need?
- Can you show me the barebones PHP code which will take these credentials and authenticate the script?

I'm sure I'm not the first person to run into this type of problem, but for the life of me, I can't find a clear explanation of what I'm doing wrong.

Ad Sense API

unread,
Aug 21, 2023, 5:09:00 AM8/21/23
to ahin...@gmail.com, adsen...@googlegroups.com
Hi Adrien,

Thanks for your email. I'd recommend starting with the documentation at https://developers.google.com/adsense/management/getting_started. That includes pages discussion OAuth (https://developers.google.com/adsense/management/direct_requests#OAuth2Authorizing), and links to PHP sample code (https://developers.google.com/adsense/management/libraries).

I hope that helps,
Andrew (AdSense API team)

ref:_00D1U1174p._5004Q2o6wEK:ref
Reply all
Reply to author
Forward
0 new messages