Bing 广告 api 仅返回我请求中第一个关键字的数据
Bing Ads api only returning data for the first keyword in my request
我正在寻找大型关键字数据集的每次点击费用和其他数据。但是,当我将请求发送到 api 时,我只收到 Keywords
中第一个关键字的返回数据 array.You 将从下面的第二张图片中注意到 EstimatedBids
单词 delivery、pizza、insurance 和 lawyer 的数据对象为空。比方说,如果我将关键字 'lawyer' 放在数组的最前面,我将获得律师的数据,而其余的则一无所获。
我的代码:
$keywords = array('flowers', 'delivery', 'pizza', 'insurance', 'lawyer'); // example array for this question
$proxy = ClientProxy::ConstructWithAccountAndCustomerId($wsdl, null, null, $DeveloperToken, $AccountId, $CustomerId, $AccessToken); //no $UserName & $Password
$matchTypes = array (MatchType::Exact);
$keywordAndMatchTypes = array();
foreach ($keywords as $keyword) {
$keywordAndMatchType = new KeywordAndMatchType();
$keywordAndMatchType->KeywordText = $keyword;
$keywordAndMatchType->MatchTypes = $matchTypes;
array_push($keywordAndMatchTypes, $keywordAndMatchType);
}
$request_cpc = new GetEstimatedBidByKeywordsRequest();
$request_cpc->Keywords = $keywordAndMatchTypes;
$response_cpc = $proxy->GetService()->GetEstimatedBidByKeywords($request_cpc)->KeywordEstimatedBids;
我的要求:
我的回复:
需要更改什么才能获得所有关键字的数据?在此先感谢您的帮助。
对于任何未来的 googlers,我通过在 foreach
循环中实例化 $matchTypes
数组解决了我的问题。换句话说,我更改了这个旧代码:
$matchTypes = array (MatchType::Exact);
$keywordAndMatchTypes = array();
foreach ($keywords as $keyword) {
$keywordAndMatchType = new KeywordAndMatchType();
$keywordAndMatchType->KeywordText = $keyword;
$keywordAndMatchType->MatchTypes = $matchTypes;
array_push($keywordAndMatchTypes, $keywordAndMatchType);
}
进入这个新代码:
$keywordAndMatchTypes = array();
foreach ($keywords as $keyword) {
$keywordAndMatchType = new KeywordAndMatchType();
$matchTypes = array (MatchType::Exact);
$keywordAndMatchType->KeywordText = $keyword;
$keywordAndMatchType->MatchTypes = $matchTypes;
array_push($keywordAndMatchTypes, $keywordAndMatchType);
}
由于某些原因,$matchTypes
数组每次都必须实例化。
我正在寻找大型关键字数据集的每次点击费用和其他数据。但是,当我将请求发送到 api 时,我只收到 Keywords
中第一个关键字的返回数据 array.You 将从下面的第二张图片中注意到 EstimatedBids
单词 delivery、pizza、insurance 和 lawyer 的数据对象为空。比方说,如果我将关键字 'lawyer' 放在数组的最前面,我将获得律师的数据,而其余的则一无所获。
我的代码:
$keywords = array('flowers', 'delivery', 'pizza', 'insurance', 'lawyer'); // example array for this question
$proxy = ClientProxy::ConstructWithAccountAndCustomerId($wsdl, null, null, $DeveloperToken, $AccountId, $CustomerId, $AccessToken); //no $UserName & $Password
$matchTypes = array (MatchType::Exact);
$keywordAndMatchTypes = array();
foreach ($keywords as $keyword) {
$keywordAndMatchType = new KeywordAndMatchType();
$keywordAndMatchType->KeywordText = $keyword;
$keywordAndMatchType->MatchTypes = $matchTypes;
array_push($keywordAndMatchTypes, $keywordAndMatchType);
}
$request_cpc = new GetEstimatedBidByKeywordsRequest();
$request_cpc->Keywords = $keywordAndMatchTypes;
$response_cpc = $proxy->GetService()->GetEstimatedBidByKeywords($request_cpc)->KeywordEstimatedBids;
我的要求:
我的回复:
需要更改什么才能获得所有关键字的数据?在此先感谢您的帮助。
对于任何未来的 googlers,我通过在 foreach
循环中实例化 $matchTypes
数组解决了我的问题。换句话说,我更改了这个旧代码:
$matchTypes = array (MatchType::Exact);
$keywordAndMatchTypes = array();
foreach ($keywords as $keyword) {
$keywordAndMatchType = new KeywordAndMatchType();
$keywordAndMatchType->KeywordText = $keyword;
$keywordAndMatchType->MatchTypes = $matchTypes;
array_push($keywordAndMatchTypes, $keywordAndMatchType);
}
进入这个新代码:
$keywordAndMatchTypes = array();
foreach ($keywords as $keyword) {
$keywordAndMatchType = new KeywordAndMatchType();
$matchTypes = array (MatchType::Exact);
$keywordAndMatchType->KeywordText = $keyword;
$keywordAndMatchType->MatchTypes = $matchTypes;
array_push($keywordAndMatchTypes, $keywordAndMatchType);
}
由于某些原因,$matchTypes
数组每次都必须实例化。