我正在尝试编写一个与 Affiliate Window API 集成的应用程序。我唯一的问题是我在 php 方面的经验实际上是 0,所以发现自己甚至无法调试最基本的问题。
我下载了下面的代码,它应该是一个示例应用程序。不幸的是,运行它在第一个障碍中失败了:
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>";
}
}
?>