0
我正在嘗試編寫與合作伙伴窗口API集成的應用程序。我遇到的唯一問題是我在PHP中幾乎沒有經驗,所以發現自己無法調試即使是最基本的問題。在PHP中加入合作伙伴窗口API集成
我下載了應該是示例應用程序的下面的代碼。不幸的是運行它未能在第一關:
Invalid argument supplied for foreach() in /Users/ravinthambapillai/Downloads/api.client/listmerchants.php on line 9
這是錯誤消息我得到當我運行如下:
誰能幫助我什麼,我需要修復得到這個權利?
<?php
define('API', 'PS');
require_once('constants.inc.php');
require_once('classes/class.ClientFactory.php');
$oClient = ClientFactory::getClient(REDACTED, REDACTED, merchant);
$listmerchants = array('iCategoryId'=> 97, 'iMaxResult' => 10);
echo 'hello world';
$oResponse= $oClient->call('getMerchantList', $listmerchants);
foreach($oResponse->oMerchant as $details){
$name = $details->sName;
$strapline = $details->sStrapline;
$description = $details->sDescription;
$logo = $details->sLogoUrl;
$showurl = $details->sDisplayUrl;
$deeplink = $details->sClickThroughUrl;
$id = $details->iId;
if ($logo<>'') {
echo "<a href=".$deeplink." title='".$name."'><img src=".$logo.
" style='float:left; margin:5px;' alt='".$name.
" :: ".$strapline." :: ".$description." :: ".$showurl.
"' width=\"88\" height=\"31\" border=\"0\"></a>";
}
}
?>
基本上你的錯誤意味着'$ oResponse-> oMerchant'不是foreach循環工作所需的對象數組。這意味着你之前的電話在某種程度上失敗了。 – jtheman