I was trying to connect QuickBooks Online with PHP. I am using Xampp server Windows operating system.
I followed API from consolibyte. I downloaded the Quickbooks-PHP-Master repository and made changes to config.php file.
I have an app on Intuit Development and have 3 keys.
When I run the index.php page, it all works.
But when I click on "connect to quickbooks" button. Error appears:
Error Code: internal_error Message: Error getting application from request token
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;
}
Any solutions please.
The response of troubleshooting.php file
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