// Campaign Management WSDL
$wsdl = "https://campaign.api.bingads.microsoft.com/Api/Advertiser/CampaignManagement/V10/CampaignManagementService.svc?singleWsdl";
$ids = null;
try {
    $proxy = ClientProxy::ConstructWithAccountAndCustomerId($wsdl, $UserName, $Password, $DeveloperToken, $AccountId, $CustomerId, null);
    $stores = GetStores($proxy);
    if (!isset($stores)) {
        printf("Customer %d does not have any regeistered BMC stores.\n\n", $CustomerId);
        return;
    }
    // Create a Bing Shopping campaign using the ID of the first store in the list.
    $campaignIds = AddCampaigns($proxy, $AccountId, $stores[0]->Id);
    PrintCampaignIdentifiers($campaignIds->long);
    $adGroupIds = AddAdGroups($proxy, $campaignIds->long[0]);
    PrintAdGroupIdentifiers($adGroupIds->long);
    $response = AddAds($proxy, $adGroupIds->long[0]);
    PrintAdIdentifiers($response->AdIds->long, $response->PartialErrors);
    // Add criterion to the campaign. The criterion is used to limit the campaign to a subset of
    // your product catalog.
    $addCriterionResponse = AddCampaignCriterion($proxy, $campaignIds->long[0]);
    PrintCampaignCriterionIdentifiers($addCriterionResponse->CampaignCriterionIds->long, $addCriterionResponse->NestedPartialErrors);
    AddAndUpdateAdGroupCriterion($proxy, $AccountId, $PartitionActions, $adGroupIds->long[0]);
    $applyPartitionActionsResponse = AddBranchAndLeafCriterion($proxy, $AccountId, $PartitionActions, $adGroupIds->long[0]);
    $rootId = $applyPartitionActionsResponse->AdGroupCriterionIds->long[1];
    $electronicsCriterionId = $applyPartitionActionsResponse->AdGroupCriterionIds->long[8];
    UpdateBranchAndLeafCriterion($proxy, $PartitionActions, $AccountId, $adGroupIds->long[0], $rootId, $electronicsCriterionId);
    // Delete the campaign from the account.
    //DeleteCampaigns($proxy, $AccountId, $campaignIds->long);
    //printf("Deleted CampaignId %d\n", $campaignIds->long[0]); // Added just the one
} catch (SoapFault $e) {
    // Output the last request/response.
        $customParameter2->Value = "summer";
        $textAd->UrlCustomParameters->Parameters[] = $customParameter2;
        $ads[] = new SoapVar($textAd, SOAP_ENC_OBJECT, 'TextAd', $proxy->GetNamespace());
    }
    $ads[0]->enc_value->Title = "Women's Shoe Sale";
    $ads[1]->enc_value->Title = "Women's Super Shoe Sale";
    $ads[2]->enc_value->Title = "Women's Red Shoe Sale";
    $ads[3]->enc_value->Title = "";
    $ads[4]->enc_value->Title = "Women's Super Shoe Sale";
    // Add the campaign, ad group, keywords, and ads
    $campaignIds = AddCampaigns($proxy, $AccountId, $campaigns);
    $adGroupIds = AddAdGroups($proxy, $campaignIds[0], $adGroups);
    $addKeywordsResponse = AddKeywords($proxy, $adGroupIds[0], $keywords);
    $keywordIds = $addKeywordsResponse->KeywordIds->long;
    $keywordErrors = $addKeywordsResponse->PartialErrors->BatchError;
    $addAdsResponse = AddAds($proxy, $adGroupIds[0], $ads);
    $adIds = $addAdsResponse->AdIds->long;
    $adErrors = $addAdsResponse->PartialErrors->BatchError;
    // Print the new assigned campaign and ad group identifiers
    PrintCampaignIdentifiers($campaignIds);
    PrintAdGroupIdentifiers($adGroupIds);
    // Print the new assigned keyword and ad identifiers, as well as any partial errors
    PrintKeywordResults($keywords, $keywordIds, $keywordErrors);
    PrintAdResults($ads, $adIds, $adErrors);
    // Delete the campaign, ad group, keyword, and ad that were previously added.
    // You should remove this line if you want to view the added entities in the
    // Bing Ads web application or another tool.
    DeleteCampaigns($proxy, $AccountId, array($campaignIds[0]));
    printf("Deleted CampaignId %d\n\n", $campaignIds[0]);
} catch (SoapFault $e) {
    // Output the last request/response.
Example #3
0
<?php

session_start();
include '../model/set.php';
$departementArray = array('Alibori' => '1', 'Atacora' => '2', 'Donga' => '3', 'Borgou' => '4', 'Collines' => '5', 'Zou' => '6', 'Couffo' => '7', 'Plateau' => '8', 'Mono' => '9', 'Atlantique' => '10', 'Littoral' => '11', 'Ouémé' => '12');
$array_post = array();
array_push($array_post, $_POST['title']);
array_push($array_post, $_POST['price']);
array_push($array_post, $_POST['description']);
array_push($array_post, date("Y-m-d"));
array_push($array_post, $_POST['img_link']);
array_push($array_post, $_SESSION['department']);
array_push($array_post, $_SESSION['id']);
array_push($array_post, $_SESSION['surname'] . ' ' . $_SESSION['name']);
array_push($array_post, $_SESSION['phone']);
array_push($array_post, $_SESSION['email']);
$i = 0;
$error = false;
while ($i != sizeof($array_post)) {
    if (empty($array_post[$i])) {
        $error = true;
    }
    $i++;
}
if ($error == true) {
    header('Location: ../ads.php?region=' . $departementArray[$_SESSION['department']] . '&error=1');
} else {
    AddAds($_POST['title'], $_POST['price'], $_POST['description'], date("Y-m-d"), $_POST['img_link'], $_SESSION['department'], $_SESSION['id'], $_SESSION['surname'] . ' ' . $_SESSION['name'], $_SESSION['phone'], $_SESSION['email']);
    header('Location: ../ads.php?region=' . $departementArray[$_SESSION['department']]);
}