我正在使用来自github.com/consolibyte/quickbooks-php的Quickbooks PHP DevKit
点击“连接到Quickbooks”图标后出现以下错误页面:
注意:未定义的索引:oauth_token in /srv/disk14/2290833/www/qbstream.scienceontheweb.net/QuickBooks/IPP/IntuitAnywhere.php 在第468行
注意:未定义的索引:oauth_token_secret in /srv/disk14/2290833/www/qbstream.scienceontheweb.net/QuickBooks/IPP/IntuitAnywhere.php 在第468行
注意:未定义的索引:oauth_token in /srv/disk14/2290833/www/qbstream.scienceontheweb.net/QuickBooks/IPP/IntuitAnywhere.php 在485线上
警告:无法修改标头信息 - 已发送的标头 (输出始于 /srv/disk14/2290833/www/qbstream.scienceontheweb.net/QuickBooks/IPP/IntuitAnywhere.php:468) 在 /srv/disk14/2290833/www/qbstream.scienceontheweb.net/QuickBooks/IPP/IntuitAnywhere.php 在第443行
我在index.php中添加了一些print语句,以显示SQL数据库正在连接并存储我编辑过的config.php中的变量: http://qbstream.scienceontheweb.net/docs/partner_platform/example_app_ipp_v3/index.php
附件是我在developer.intuit.com上的开发密钥和开发设置(附加到密钥的设置图片,因为我在这篇文章中只允许2个链接):
这是我的config.php
<?php
/**
* Intuit Partner Platform configuration variables
*
* See the scripts that use these variables for more details.
*
* @package QuickBooks
* @subpackage Documentation
*/
// Turn on some error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Require the library code
require_once dirname(__FILE__) . '/../../../QuickBooks.php';
//require_once('/home/www/qbstream.scienceontheweb.net/QuickBooks.php');
// Your application token (Intuit will give you this when you register an Intuit Anywhere app)
$token = '99cbe16bba521b4f25b99cbb4ad297910a33';
// Your OAuth consumer key and secret (Intuit will give you both of these when you register an Intuit app)
//
// IMPORTANT:
// To pass your tech review with Intuit, you'll have to AES encrypt these and
// store them somewhere safe.
//
// The OAuth request/access tokens will be encrypted and stored for you by the
// PHP DevKit IntuitAnywhere classes automatically.
$oauth_consumer_key = 'qyprdq1tdxuG9uvFFY4dQnNWtrA8a3';
$oauth_consumer_secret = 'qKK95MELeifFxcxuy7zeApvtncRcQfYtmYS9TCHi';
// If you're using DEVELOPMENT TOKENS, you MUST USE SANDBOX MODE!!! If you're in PRODUCTION, then DO NOT use sandbox.
$sandbox = true; // When you're using development tokens
//$sandbox = false; // When you're using production tokens
// This is the URL of your OAuth auth handler page
//$quickbooks_oauth_url = 'http://quickbooks.v3.com:8888/quickbooks-php/docs/partner_platform/example_app_ipp_v3/oauth.php';
$quickbooks_oauth_url = 'http://qbstream.scienceontheweb.net/docs/partner_platform/example_app_ipp_v3/oauth.php';
// This is the URL to forward the user to after they have connected to IPP/IDS via OAuth
//$quickbooks_success_url = 'http://quickbooks.v3.com:8888/quickbooks-php/docs/partner_platform/example_app_ipp_v3/success.php';
$quickbooks_success_url = 'http://qbstream.scienceontheweb.net/docs/partner_platform/example_app_ipp_v3/success.php';
// This is the menu URL script
//$quickbooks_menu_url = 'http://quickbooks.v3.com:8888/quickbooks-php/docs/partner_platform/example_app_ipp_v3/menu.php';
$quickbooks_menu_url = 'http://qbstream.scienceontheweb.net/docs/partner_platform/example_app_ipp_v3/menu.php';
// This is a database connection string that will be used to store the OAuth credentials
// $dsn = 'pgsql://username:password@hostname/database';
// $dsn = 'mysql://username:password@hostname/database';
$dsn = mysqli_connect("etc,etc,etc,etc");
// You should set this to an encryption key specific to your app
$encryption_key = 'bcde1234';
// Do not change this unless you really know what you're doing!!! 99% of apps will not require a change to this.
$the_username = 'DO_NOT_CHANGE_ME';
// The tenant that user is accessing within your own app
$the_tenant = 12345;
// Initialize the database tables for storing OAuth information
if (!QuickBooks_Utilities::initialized($dsn))
{
// Initialize creates the neccessary database schema for queueing up requests and logging
QuickBooks_Utilities::initialize($dsn);
}
// Instantiate our Intuit Anywhere auth handler
//
// The parameters passed to the constructor are:
// $dsn
// $oauth_consumer_key Intuit will give this to you when you create a new Intuit Anywhere application at AppCenter.Intuit.com
// $oauth_consumer_secret Intuit will give this to you too
// $this_url This is the full URL (e.g. http://path/to/this/file.php) of THIS SCRIPT
// $that_url After the user authenticates, they will be forwarded to this URL
//
$IntuitAnywhere = new QuickBooks_IPP_IntuitAnywhere($dsn, $encryption_key, $oauth_consumer_key, $oauth_consumer_secret, $quickbooks_oauth_url, $quickbooks_success_url);
// Are they connected to QuickBooks right now?
if ($IntuitAnywhere->check($the_username, $the_tenant) and
$IntuitAnywhere->test($the_username, $the_tenant))
{
// Yes, they are
$quickbooks_is_connected = true;
// Set up the IPP instance
$IPP = new QuickBooks_IPP($dsn);
// Get our OAuth credentials from the database
$creds = $IntuitAnywhere->load($the_username, $the_tenant);
// Tell the framework to load some data from the OAuth store
$IPP->authMode(
QuickBooks_IPP::AUTHMODE_OAUTH,
$the_username,
$creds);
if ($sandbox)
{
// Turn on sandbox mode/URLs
$IPP->sandbox(true);
}
// Print the credentials we're using
//print_r($creds);
// This is our current realm
$realm = $creds['qb_realm'];
// Load the OAuth information from the database
$Context = $IPP->context();
// Get some company info
$CompanyInfoService = new QuickBooks_IPP_Service_CompanyInfo();
$quickbooks_CompanyInfo = $CompanyInfoService->get($Context, $realm);
}
else
{
// No, they are not
$quickbooks_is_connected = false;
}
请帮我连接到直觉。谢谢。