GetAdGroupsByCampaignIdRequest不返回数据或错误 [英] GetAdGroupsByCampaignIdRequest not returning data or errors
问题描述
我已经检查过以确保凭据和其他代码正常工作。例如,我可以成功运行GetCampaignsByAccountIdRequest();它返回一个Campaign对象列表。
I have already checked to ensure that credentials and other code is working. For example I can succesfully run GetCampaignsByAccountIdRequest(); and it returns a list of Campaign objects.
这是我的代码(我目前正在使用
$req = new GetAdGroupsByCampaignIdRequest();
$req->CampaignId = 268289928;
var_dump($req);
$res = $proxy->GetService()->GetAdGroupsByCampaignIdRequest($req);
我希望它甚至会产生错误。我已经从以下网站下载了最新的PHP代码:
I wish it would even produce an error. I have downloaded the most recent php code from:
https://code.msdn.microsoft.com/Bing -Ads-API-Version-9-in-fb27761f
https://code.msdn.microsoft.com/Bing-Ads-API-Version-9-in-fb27761f
以下是整个代码页:
include 'bingads/ClientProxy.php';
include 'bingads/CampaignManagementClasses.php';
//1
use BingAds\v10\CampaignManagement\CampaignManagementServiceSettings;
use BingAds\v10\CampaignManagement\GetCampaignsByAccountIdRequest;
use BingAds\v10\CampaignManagement\CampaignType;
use BingAds\v10\CampaignManagement\AdGroup;
use BingAds\v10\CampaignManagement\GetAdGroupsByCampaignIdRequest;
use BingAds\v10\CampaignManagement\GetAdGroupsByIdsRequest;
/*
* @used-by GetAdGroupsByCampaignIdRequest
* @used-by GetAdGroupsByIdsRequest
*/
//2
use BingAds\v10\CampaignManagement\Campaign;
use BingAds\v10\CampaignManagement\UpdateCampaignsRequest;
//common
use BingAds\Proxy\ClientProxy;
function getCampaignsByAccountId($settings, $sandbox=false) {
$endpoint = $sandbox? CampaignManagementServiceSettings::SandboxEndpoint : CampaignManagementServiceSettings::ProductionEndpoint;
$proxy = ClientProxy::ConstructWithAccountAndCustomerId($endpoint."?wsdl", $settings['UserName'], $settings['Password'], $settings['DeveloperToken'], $settings['AccountId'], $settings['CustomerId'], $settings['AuthenticationToken']);
$req = new GetAdGroupsByCampaignIdRequest();
$req->CampaignId = 268659928;
var_dump($req);
$res = $proxy->GetService()->GetAdGroupsByCampaignIdRequest($req);
推荐答案
应该更新的一部分是删除'请求'从这里:
One part that should be updated, is remove 'Request' from here:
proxy - > GetService () - > GetAdGroupsByCampaignIdRequest (
proxy->GetService()->GetAdGroupsByCampaignIdRequest(
req );
req);
您已构建了请求消息,现在可以通过操作名称调用服务,即
GetAdGroupsByCampaignId :
You have already constructed the request message and can now call the service by operation name i.e. GetAdGroupsByCampaignId:
这篇关于GetAdGroupsByCampaignIdRequest不返回数据或错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!