通过PHP-SDK向广告系列添加否定网站 [英] Adding Negative Sites to a Campaign via the PHP-SDK
问题描述
你好。
我一直在讨厌这个问题,但我似乎无法弄明白。
I've been racking my head on this but I can't seem to figure it out.
我正在尝试通过PHP-SDK和API将单个域作为负面网站添加到广告系列。
I'm trying to add a single domain as a negative Site to a campaign via the PHP-SDK and API.
以下是设置要排除的CampaignId和DOMAIN.COM的PHP代码:
Here is the PHP code that sets the CampaignId and DOMAIN.COM to exclude:
$campaignNegativeSitesCriterion = new CampaignNegativeSites();
$campaignNegativeSitesCriterion->CampaignId = $CampaignId;
$campaignNegativeSitesCriterion->NegativeSites = array("DOMAIN.com");
$encodedCriterion = new SoapVar($campaignNegativeSitesCriterion, SOAP_ENC_OBJECT);
$SetNegativeSitesToCampaignsRequest->CampaignNegativeSites = $encodedCriterion;
$encodedCriterion = new SoapVar($SetNegativeSitesToCampaignsRequest, SOAP_ENC_OBJECT);
$campaignCriterions = CampaignManagementHelper::SetNegativeSitesToCampaigns($AccountId,$encodedCriterion);
以下是我传递给Bing Ads的XML:
Here is the XML I'm passing to Bing Ads:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://bingads.microsoft.com/CampaignManagement/v11" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header><ns1:CustomerAccountId>REDACTED</ns1:CustomerAccountId><ns1:CustomerId>REDACTED</ns1:CustomerId><ns1:DeveloperToken>REDACTED</ns1:DeveloperToken><ns1:UserName/><ns1:Password/><ns1:AuthenticationToken>REDACTED</ns1:AuthenticationToken></SOAP-ENV:Header><SOAP-ENV:Body><ns1:SetNegativeSitesToCampaignsRequest><ns1:AccountId>REDACTED</ns1:AccountId><ns1:CampaignNegativeSites><CampaignNegativeSites><CampaignId>REDACTED</CampaignId><NegativeSites><xsd:string>DOMAIN.com</xsd:string></NegativeSites></CampaignNegativeSites></ns1:CampaignNegativeSites></ns1:SetNegativeSitesToCampaignsRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
我是使用了此页面中的PHP函数 - https://docs.microsoft.com/en-us/bin gads / campaign-management-service / setnegativesitestocampaigns
I've used the PHP function from this page - https://docs.microsoft.com/en-us/bingads/campaign-management-service/setnegativesitestocampaigns
我传递给Bing Ads的SOAP请求几乎与上面列出的页面相同。 我不确定还有什么可以尝试。 我收到以下错误:
The SOAP request I'm passing to Bing Ads is almost identical to the page listed above. I'm not sure what else to try. I'm getting the following error:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>s:Server</faultcode><faultstring xml:lang="en-US">Invalid client data. Check the SOAP fault details for more information</faultstring><detail><ApiFaultDetail xmlns="https://bingads.microsoft.com/CampaignManagement/v11" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><TrackingId xmlns="https://adapi.microsoft.com">f8bca694-3db8-45c7-8030-ed67dcdc8c9f</TrackingId><BatchErrors/><OperationErrors><OperationError><Code>1132</Code><Details i:nil="true"/><ErrorCode>CampaignServiceNullCampaignNegativeSites</ErrorCode><Message>CampaignSiteExclusions is null.</Message></OperationError></OperationErrors></ApiFaultDetail></detail></s:Fault></s:Body></s:Envelope>
感谢您的帮助!
$
Thanks for your help!
推荐答案
此方案不需要编码的SoapVar。由于命名空间不匹配,可能无法识别负面网站。
The encoded SoapVar shouldn't be necessary for this scenario. Likely the negative sites are not recognized due to a namespace mismatch.
我尝试了以下代码段:
campaignNegativeSites = new CampaignNegativeSites();
campaignNegativeSites = new CampaignNegativeSites();
negativeSites = array(" http://www.contoso.com/");
negativeSites = array("http://www.contoso.com/");
这篇关于通过PHP-SDK向广告系列添加否定网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!