无法创建广告系列,广告系列ID返回为空 [英] Can't create campaign, campaign ids returns empty
问题描述
我正在尝试使用此代码创建一个包含api的广告系列:
I'm trying to create a campaign with the api using this code:
我只是关注此示例:
https://msdn.microsoft.com/en-us/library/bing-ads-keywords-php-code-example.aspx
https://msdn.microsoft.com/en-us/library/bing-ads-keywords-php-code-example.aspx
问题是,竞选活动返回为空我没有收到任何错误消息。什么可以发生?
The problem is that campaignids is returning empty and I get no error message. What can be ocurring?
$campaigns = array();
$ campaign = new Campaign();  
$campaign = new Campaign();
$ campaign-> Name =" Winter Clothing" 。 $ _SERVER [" REQUEST_TIME"];   
$campaign->Name = "Winter Clothing " . $_SERVER['REQUEST_TIME'];
$ campaign-> Description =" Winter clothing line。"  
$campaign->Description = "Winter clothing line.";
$ campaign-> BudgetType = BudgetLimitType :: MonthlyBudgetSpendUntilDepleted;  
$campaign->BudgetType = BudgetLimitType::MonthlyBudgetSpendUntilDepleted;
$ campaign-> MonthlyBudget = 1000.00;  
$campaign->MonthlyBudget = 1000.00;
$ campaign-> TimeZone =" PacificTimeUSCanadaTijuana";  
$campaign->TimeZone = "PacificTimeUSCanadaTijuana";
$ campaign-> DaylightSaving = true;  
$campaign->DaylightSaving = true;
var_dump(" campaign"。$ campaign-> Name);  
var_dump("campaign ".$campaign->Name);
$ campaign-> TrackingUrlTemplate =" http://tracker.example.com/?season = {_season}& promocode = {_promocode}& u = {lpurl}";
$campaign->TrackingUrlTemplate = "http://tracker.example.com/?season={_season}&promocode={_promocode}&u={lpurl}";
$ campaigns [] = $ campaign;
$campaigns[] = $campaign;
$ campaignIds = AddCampaigns($ proxy,$ AccountId,$ campaign);
$campaignIds = AddCampaigns($proxy, $AccountId, $campaigns);
PrintCampaignIdentifiers($ campaignIds) ; 
PrintCampaignIdentifiers($campaignIds);
功能AddCampaigns($ proxy,$ accountId,$ campaigns){  
function AddCampaigns($proxy, $accountId, $campaigns){
//设置请求信息。  
// Set the request information.
$ request = new AddCampaignsRequest();  
$request = new AddCampaignsRequest();
$ request-> AccountId = $ accountId;  
$request->AccountId = $accountId;
$ request->广告系列= $ campaign;  
$request->Campaigns = $campaigns;
返回$ proxy-> GetService() - > AddCampaigns($ request) - > CampaignIds-> long;
return $proxy->GetService()->AddCampaigns($request)->CampaignIds->long;
}
function PrintCampaignIdentifiers ($ campaignIds){   
function PrintCampaignIdentifiers($campaignIds){
如果(空($ campaignIds))    {       
if(empty($campaignIds)) {
返回;    }
return; }
    foreach($ campaignIds为$ id)   {
foreach ($campaignIds as $id) {
        printf("广告系列已成功添加并分配了CampaignId%s \ n \ nn",$ id);
printf("Campaign successfully added and assigned CampaignId %s\n\n", $id);
  }
}
}
推荐答案
您使用的是沙箱吗?我目前正在观察沙箱中的一些间歇性问题,它可能是相关的。您可以在调用AddCampaigns后立即添加这些行,以查看错误:
Are you using sandbox? I'm currently observing some intermittent issues in sandbox, and it could be related. You can add these lines immediately after the call to AddCampaigns, to see the error:
print "\nLast SOAP request/response:\n";
print
proxy-> GetWsdl()。 " \\\
英寸;
proxy->GetWsdl() . "\n"; print
proxy-> GetService() - > __ getLastRequest()。" \ n" ;;
proxy->GetService()->__getLastRequest()."\n"; print
这篇关于无法创建广告系列,广告系列ID返回为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!