AddAds() with Adcenter API V5, PHP5 SOAP Extension RRS feed

  • General discussion


    For those of you like me who had trouble implementing AddAds() with PHP5 SOAP and version 5 of the API, the trick is in declaring the 'TextAd' type in the SoapVar, and getting the namespace right:


    $ad = array (

    'Title' => $title,

    'Text' => $text,

    'DisplayUrl' => $displayUrl,

    'DestinationUrl' => $url,

    'Id' => $ID,

    'Type' => $type



    $textAd=new SoapVar($ad,SOAP_ENC_OBJECT,'TextAd','https://adcenter.microsoft.com/api/advertiser/v5');


    $adsParam = array( 'AdGroupId' => $adGroupID,'Ads' => array('Ad'=>$textAd) );


    $retObj = execute($campaignService, 'AddAds', $adsParam);

    Monday, January 28, 2008 3:54 AM

All replies

  • Hi,


    I was wondering if you could provide the XML request for the 'AddAds' call.

    I'm trying to get it to work on PERL but I'm not able to do.


    Thanks and best regards,


    Thursday, March 20, 2008 12:03 PM
  • Hi Snehal,


    Does the Perl AddAds sample at How to Create Ads in Perl (V5) provide you with the details that you need?



    Walter Poupore

    Lead Programming Writer

    Microsoft adCenter API

    Thursday, March 20, 2008 7:43 PM
  • Thanks for the example - it was very helpful.

    I am wondering how can I get the Title, DisplayUrl and Text attributes (those housed within the TextAd object) during the GetAdsByAdGroupId() API call?  The documentation seems to suggest that it will only return the attributes of the Ad object (though I haven't gotten far enough in development to test this assumption) ... would I have to do something like this or will the API response return a TextAd object?
    Monday, April 28, 2008 5:05 PM