我试图将QuickBooks Online与PHP连接起来。我正在使用Xampp服务器Windows操作系统。
我从consolibyte跟踪了API。我下载了Quickbooks-PHP-Master存储库并对config.php文件进行了更改。
我在Intuit Development上有一个应用程序,有3个键。
当我运行index.php页面时,一切正常。
但是当我点击“连接到quickbooks”按钮时。出现错误:
错误代码:internal_error 消息:从请求令牌获取应用程序时出错
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Require the library code
require_once dirname(__FILE__) . '/../../../QuickBooks.php';
$token = '76ac0cdabc168b42c2bb997bba4ef0beb2c0';
$oauth_consumer_key = 'qyprdkDO0aY2NHrrk9xx6JZB3xbrIB';
$oauth_consumer_secret = 'eqcBAjc8SnOpVsz49Nf6H5ms58Ns2Up4PJPAe8o5';
$sandbox = true;
$quickbooks_oauth_url = 'http://localhost:81/quickbooks-php- master/docs/partner_platform/example_app_ipp_v3/oauth.php';
$quickbooks_success_url = 'http://localhost:81/quickbooks-php-master/docs/partner_platform/example_app_ipp_v3/success.php';
$quickbooks_menu_url = 'http://localhost:81/quickbooks-php-master/docs/partner_platform/example_app_ipp_v3/menu.php';
$dsn = 'mysqli://root:@localhost/test';
$encryption_key = 'bcde1234';
$the_username = 'DO_NOT_CHANGE_ME';
$the_tenant = 12345;
if (!QuickBooks_Utilities::initialized($dsn))
{
QuickBooks_Utilities::initialize($dsn);
}
$IntuitAnywhere = new QuickBooks_IPP_IntuitAnywhere($dsn, $encryption_key, $oauth_consumer_key, $oauth_consumer_secret, $quickbooks_oauth_url, $quickbooks_success_url);
if ($IntuitAnywhere->check($the_username, $the_tenant) and
$IntuitAnywhere->test($the_username, $the_tenant))
{
$quickbooks_is_connected = true;
$IPP = new QuickBooks_IPP($dsn);
$creds = $IntuitAnywhere->load($the_username, $the_tenant);
$IPP->authMode(
QuickBooks_IPP::AUTHMODE_OAUTH,
$the_username,
$creds);
if ($sandbox)
{
$IPP->sandbox(true);
}
$realm = $creds['qb_realm'];
$Context = $IPP->context();
$CompanyInfoService = new QuickBooks_IPP_Service_CompanyInfo();
$quickbooks_CompanyInfo = $CompanyInfoService->get($Context, $realm);
}
else
{
$quickbooks_is_connected = false;
}
请解决任何问题。
troubleshooting.php文件的响应
Trying to hit URL: https://oauth.intuit.com/oauth/v1/get_request_token
Did we disable SSL checks? false
<br />
<b>Warning</b>: curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in <b>C:\xampp\htdocs\quickbook2\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />
Trying to hit URL: https://appcenter.intuit.com/api/v1/Connection/Reconnect
Did we disable SSL checks? false
<br />
<b>Warning</b>: curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in <b>C:\xampp\htdocs\quickbook2\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />
Trying to hit URL: https://oauth.intuit.com/oauth/v1/get_request_token
Did we disable SSL checks? true
<br />
<b>Warning</b>: curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in <b>C:\xampp\htdocs\quickbook2\quickbooks-php- master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />
oauth_problem=parameter_absent&oauth_parameters_absent=oauth_signature
Trying to hit URL: https://appcenter.intuit.com/api/v1/Connection/Reconnect
Did we disable SSL checks? true
<br />
<b>Warning</b>: curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in <b>C:\xampp\htdocs\quickbook2\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />
<?xml version="1.0" encoding="utf-8"?>
<PlatformResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://platform.intuit.com/api/v1">
<ErrorMessage>Authentication required</ErrorMessage>
<ErrorCode>22</ErrorCode>
<ServerTime>2017-03-23T13:08:09.853153Z</ServerTime>
</PlatformResponse>
php version: 5.6.30
mcrypt extension? true
mcrypt module rijndael-256? NULL
curl extension? true
答案 0 :(得分:0)
根据您上面发布的内容,您的PHP安装似乎无法正确验证SSL证书。
试试这个:
将此行更改为if (true)
:
将此行更改为if (true)
:
再试一次。如果修复它,那么您就知道您的PHP安装已损坏 - 它没有正确验证SSL证书。
然后,您应该考虑修复PHP安装: