Php 获取客户端信息的收获API
我试图调用Harvest API来获取客户机信息。我试图遵循Harvest提供的官方文件。但一旦我运行代码,它就不会给出任何输出 这是我的密码Php 获取客户端信息的收获API,php,api,harvest,Php,Api,Harvest,我试图调用Harvest API来获取客户机信息。我试图遵循Harvest提供的官方文件。但一旦我运行代码,它就不会给出任何输出 这是我的密码 <?php require_once(dirname(__FILE__) . '/HarvestAPI.php'); spl_autoload_register(array('HarvestAPI', 'autoload') ); $harvest_user = $user; // Your Harvest username, usually a
<?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";
}
?>
但它总是返回不成功的。请给出我如何克服这个问题的建议。我今天试着用同样的代码来处理它,猜猜它是怎么工作的!我只是添加了几行来打印数组
<?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";
}
@KirkBeard这是我在allobject(Harvest_Result)#2(3){[“_code”:protected]=>int(401)[“_data”:protected]=>string(120)“API请求的身份验证失败。”[“_headers”:protected]=>array(20)@KirkBeard它太长了,所以我无法发布整个过程result@KirkBeard是的