Пример #1
0
 function getActiveAds()
 {
     $soapClients =& APIlityClients::getClients();
     $someSoapClient = $soapClients->getAdClient();
     $soapParameters = "<getActiveAds>\n                           <adGroupIds>" . $this->getId() . "</adGroupIds>\n                         </getActiveAds>";
     // query the google servers for all ads
     $allAds = array();
     $allAds = $someSoapClient->call("getActiveAds", $soapParameters);
     $soapClients->updateSoapRelatedData(extractSoapHeaderInfo($someSoapClient->getHeaders()));
     if ($someSoapClient->fault) {
         pushFault($someSoapClient, $_SERVER['PHP_SELF'] . ":getActiveAds()", $soapParameters);
         return false;
     }
     // if only one ad then copy and create (one element) array of ads
     $allAds = makeNumericArray($allAds);
     $allAdObjects = array();
     if (isset($allAds['getActiveAdsReturn'])) {
         foreach ($allAds['getActiveAdsReturn'] as $ad) {
             $adObject = receiveAd($ad);
             if (isset($adObject)) {
                 array_push($allAdObjects, $adObject);
             }
         }
     }
     return $allAdObjects;
 }
Пример #2
0
function addVideoAd($belongsToAdGroupId, $imageLocation, $name, $video, $displayUrl, $destinationUrl, $status, $exemptionRequest = false, $checkOnly = false)
{
    // update the google servers
    $soapClients =& APIlityClients::getClients();
    $someSoapClient = $soapClients->getAdClient();
    $soapParameters = "<adGroupId>" . $belongsToAdGroupId . "</adGroupId>\n                        <image>\n                          <data xsi:type=\"xsd:base64Binary\">" . img2base64($imageLocation) . "</data>\n                          <name>Still Image</name>\n                        </image>\n                        <name>" . $name . "</name>\n                        <video>\n                          <videoId>" . $video['videoId'] . "</videoId>\n                        </video>\n                        <status>" . $status . "</status>\n                        <destinationUrl>" . $destinationUrl . "</destinationUrl>\n                        <displayUrl>" . $displayUrl . "</displayUrl>\n                        <adType>VideoAd</adType>";
    if (isset($exemptionRequest) && $exemptionRequest) {
        $soapParameters .= "<exemptionRequest>" . $exemptionRequest . "</exemptionRequest>";
    }
    if ($checkOnly) {
        return $soapParameters;
    }
    $soapParameters = "<addAds>\n                         <ads>" . $soapParameters . "\n                         </ads>\n                       </addAds>";
    // add the ad to the google servers
    $someAd = $someSoapClient->call("addAds", $soapParameters);
    $soapClients->updateSoapRelatedData(extractSoapHeaderInfo($someSoapClient->getHeaders()));
    if ($someSoapClient->fault) {
        pushFault($someSoapClient, $_SERVER['PHP_SELF'] . ":addVideoAd()", $soapParameters);
        return false;
    }
    return receiveAd($someAd['addAdsReturn']);
}