我试着打电话给收获API来获取客户信息。我试着跟踪哈佛公司提供的官方文件。但是,一旦我运行了代码,它就没有输出。
这是我的密码
<?php
require_once(dirname(__FILE__) . '/HarvestAPI.php');
spl_autoload_register(array('HarvestAPI', 'autoload') );
$harvest_user = $user; // Your Harvest username, usually an email address
$harvest_pass = $password; // Your Harvest password
$harvest_account = $account;
$harvestAPI = new HarvestAPI();
$harvestAPI->setUser($harvest_user);
$harvestAPI->setPassword($harvest_pass);
$harvestAPI->setAccount($harvest_account);
$harvestAPI->setRetryMode( HarvestAPI::RETRY );
$harvestAPI->setSSL(true);
$result = $harvestAPI->getClients();
if( $result->isSuccess() ) {
echo "Successful";
}
else{
echo "Not Successful";
}
?>但是它总是返回不成功的。请给出我如何克服这个问题的建议。
发布于 2016-04-14 15:38:01
我今天试着用同样的代码处理它,猜猜它是如何工作的!我只是增加了几行来打印数组。
<?php
require_once(dirname(__FILE__) . '/HarvestAPI.php');
spl_autoload_register(array('HarvestAPI', 'autoload') );
$harvest_user = $user; // Your Harvest username, usually an email address
$harvest_pass =$password; // Your Harvest password
$harvest_account =$account;
$harvestAPI = new HarvestAPI();
$harvestAPI->setUser($harvest_user);
$harvestAPI->setPassword($harvest_pass);
$harvestAPI->setAccount($harvest_account);
$harvestAPI->setRetryMode( HarvestAPI::RETRY );
$harvestAPI->setSSL(true);
$result = $harvestAPI->getClients();
if( $result->isSuccess() ) {
echo "Successful";
$data = $result->get( "data" );
print_r($data);
}
else{
echo "Not Successful";
}https://stackoverflow.com/questions/36585763
复制相似问题