QBO API v3 PHP调用返回NULL

时间:2017-10-17 23:56:09

标签: php quickbooks-online

我正在使用PHP的qbo-api-v3通过PHP脚本验证和检索资产负债表报告。这在过去的6个月里一直运行良好,但最近停止了返回数据(为repsonseCOde,responseBody和responsArray返回NULL)。我无法弄清楚为什么 - 任何想法?谢谢!

// qbo API
require_once dirname(__FILE__).'/../v3-php-sdk-2.2.0-RC/config.php';
require_once(PATH_SDK_ROOT . 'Core/ServiceContext.php');
require_once(PATH_SDK_ROOT . 'PlatformService/PlatformService.php');
require_once(PATH_SDK_ROOT . 'Utility/Configuration/ConfigurationManager.php');
require_once(PATH_SDK_ROOT . 'Core/CoreHelper.php');
require_once(PATH_SDK_ROOT . 'DataService/Batch.php');
require_once(PATH_SDK_ROOT . 'DataService/IntuitCDCResponse.php');
require_once(PATH_SDK_ROOT . 'Data/IntuitRestServiceDef/IPPAttachableResponse.php');
require_once(PATH_SDK_ROOT . 'Data/IntuitRestServiceDef/IPPFault.php');
require_once(PATH_SDK_ROOT . 'Data/IntuitRestServiceDef/IPPError.php');
require_once('RestServiceHandler.php');
require_once(PATH_SDK_ROOT . 'Core/OperationControlList.php');


// QBO Service Context
$serviceType = IntuitServicesType::QBO;

$oauth['AccessToken']        = ...
$oauth['AccessTokenSecret']  = ... 
$oauth['ConsumerKey']        = ... 
$oauth['ConsumerSecret']     = ...
$oauth['RealmID']            = ... 

$requestValidator = new OAuthRequestValidator(ConfigurationManager::AppSettings('AccessToken'),
                                              ConfigurationManager::AppSettings('AccessTokenSecret'),
                                              ConfigurationManager::AppSettings('ConsumerKey'),
                                              ConfigurationManager::AppSettings('ConsumerSecret'));


$serviceContext = new ServiceContext($oauth['RealmID'], $serviceType, $requestValidator); //d($serviceContext);
if (!$serviceContext) exit("Problem while initializing ServiceContext.\n");


// query for Balance Sheet Report - https://developer.intuit.com/docs/api/accounting/balance%20sheet
$report     = 'BalanceSheet'; 
$query      = "start_date=$start_date&end_date=$end_date";

$uri    = "company/{1}/reports/$report?{2}";
$uri    = str_replace("{1}", $oauth['RealmID']  , $uri);
$uri    = str_replace("{2}", $query             , $uri);

// Creates request parameters
$requestParameters  = new RequestParameters($uri,'GET',CoreConstants::CONTENTTYPE_APPLICATIONJSON, NULL);
$restRequestHandler = new RestServiceHandler($serviceContext);


// Make the request
list($responseCode,$responseBody) = $restRequestHandler->GetReportsResponse($requestParameters, NULL, NULL);
$responseArray = json_decode($responseBody, true);

0 个答案:

没有答案