Group: http://groups.google.com/group/adsense-api/topics
- Generating Ads with PHP [2 Updates]
- Sean <neolocutus@gmail.com> Apr 11 06:15PM -0700
I'm not sure if I'm missing something with this, but I'm having problems
generating ads with php and the v4.1 AdSense host.
I have all the access and refresh tokens up and running correctly, got the
link set up between the user and all that set up. Now I'm trying to create
ads for my test user.
You need to create ads first with the insert statement first, then get them
with the generateAdCode function correct?
I copied this out of the example PHP code, doing a print_r it all seems to
look correct.
$adUnit = new Google_AdUnit();
$adUnit->setName('Test 1');
$contentAdsSettings = new Google_AdUnitContentAdsSettings();
$backupOption = new Google_AdUnitContentAdsSettingsBackupOption();
$backupOption->setType('COLOR');
$backupOption->setColor('ffffff');
$contentAdsSettings->setBackupOption($backupOption);
$contentAdsSettings->setSize('SIZE_600_160'); //width then height
$contentAdsSettings->setType('TEXT');
$adUnit->setContentAdsSettings($contentAdsSettings);
$customStyle = new Google_AdStyle();
$colors = new Google_AdStyleColors();
$colors->setBackground('ffffff');
$colors->setBorder('000000');
$colors->setText('000000');
$colors->setTitle('000000');
$colors->setUrl('0000ff');
$customStyle->setColors($colors);
$customStyle->setCorners('SQUARE');
$font = new Google_AdStyleFont();
$font->setFamily('ACCOUNT_DEFAULT_FAMILY');
$font->setSize('ACCOUNT_DEFAULT_SIZE');
$customStyle->setFont($font);
$adUnit->setCustomStyle($customStyle);
This is the insert statement I'm running: ($pubID is the users pubID,
$clientID is the app client ID for the project) (I think that is correct
right?)
$result = $adsensehostService->accounts_adunits->insert($pubID, $clientID,
$adUnit);
This is the error I'm getting
*Fatal error*: Uncaught exception 'Google_ServiceException' with message
'Error calling POST
https://www.googleapis.com/adsensehost/v4.1/accounts/pub-25716040XXXXXXXXX/adclients/74197XXXXXXXXXX.apps.googleusercontent.com/adunits?key=AIzaSyDCXXXXXXXXXvkxQBU1JYplaoNwc5-E:
(404) Ad client not found.'
I've been trying to figure out what the Ad client not found means, or if
I'm even on the right track for making ads.
Any help would be appreciated.
Sean
- "Jose Alcérreca (AdSense API Team)" <adsenseapiadvisor+jose@google.com> Apr 12 02:00AM -0700
Hi Sean
Ad clients are something else:
https://developers.google.com/adsense/host/v4.1/adclients
Just list them to get your ad client id. Look for "AFC" as it's most likely
the product code you will be using.
Cheers!
Jose
---
Jose Alcérreca
Developer Relations
Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W
9TQ
Registered in England Number: 3977902
Google Inc.| Developer Relations | *AdSense API Team* |
developers.google.com/**adsense <https://developers.google.com/adsense/>
On Friday, 12 April 2013 02:15:40 UTC+1, Sean wrote:
You received this message because you are subscribed to the Google Group adsense-api.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.
You received this message because you are subscribed to the Google Groups "AdSense API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adsense-api+unsubscribe@googlegroups.com.
To post to this group, send email to adsense-api@googlegroups.com.
Visit this group at http://groups.google.com/group/adsense-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Its like you read my mind! You seem to know so much about this,
ReplyDeletelike you wrote the book in it or something. I think
that you could do with a few pics to drive the message
home a bit, but instead of that, this is fantastic
blog. A fantastic read. I will certainly be back.
Look at my weblog; fake ray bans
Here again you want to find or even create an angle or slant in which you can take headline news and 'incorporate' it into a post you are
ReplyDeletecomposing. However there are several troubleshooting steps you need to perform in
order to determine the problem. As a consequence it can be contended the media is
directing many persons astray moving away from what should
be its aim of presenting discerning news and analytic thinking of pressing topics for
this celebrity frippery.
My blog post latest celeb news