正在 Quickbooks 中执行项目检查代码 PHP
Executing Item check code in Quickbooks PHP
我正在使用 QuickBooks PHP API。我创建了一些页面,它们都在使用我的 Sandbox 帐户。但是当我尝试为真实账户做同样的事情时,它给我错误。我在 config.php
中将变量 $sandbox=true 更改为 $sandbox=false
下面是 itemchk.php
的代码
<?php
//require_once dirname(__FILE__) . '/views/header.tpl.php';
header('Content-Type: text/xml');
$tokenval = '';
$customerkey = '';
$customersecreat = '';
if(isset($_POST['tokenval']) && $_POST['tokenval'] != ''){
$tokenval = $_POST['tokenval'];
}
if(isset($_POST['customerkey']) && $_POST['customerkey'] != ''){
$customerkey = $_POST['customerkey'];
}
if(isset($_POST['customersecreat']) && $_POST['customersecreat'] != ''){
$customersecreat = $_POST['customersecreat'];
}
$quers = "ItemChkQueryRs";
if(trim($tokenval) != "" && trim($customerkey) != "" && trim($customersecreat) != ""){
require_once dirname(__FILE__) . '/config1.php';
$ItemService = new QuickBooks_IPP_Service_Item();
if(isset($_POST['Itemname']) && $_POST['Itemname'] != ''){
$Itemname=$_POST['Itemname'];
$Items = $ItemService->query($Context, $realm, "SELECT * FROM Item where name='".$Itemname."' ");
if (count($Items)){
$status = 'Success';
$statuscode = '0';
$status_message = 'Item Exist';
$Item = $Items[0];
$txnid = $Item->getId();
$txnid = str_replace("{-", "", $txnid);
$txnid = str_replace("}", "", $txnid);
}
else{
$statuscode = '0';
$status_message = 'Item does not Exist';
}
}
else{
$statuscode = '1';
$status_message = 'Item Name Missing';
}
include_once "show_xml1.php";
}
else{
$statuscode = '1';
$status_message = 'Missing Authentication Details';
include_once "show_xml1.php";
}
?>
我在执行此页面时遇到的错误是
Notice: Undefined variable: Context in /home2/ultrasou/public_html/garg.com/quickbooks/ItemChk1.php on line 27
Notice: Undefined variable: realm in /home2/ultrasou/public_html/garg.com/quickbooks/ItemChk1.php on line 27
Fatal error: Call to a member function IPP() on a non-object in /home2/ultrasou/public_html/garg.com/quickbooks/QuickBooks/IPP/Service.php on line 829
将 $sandbox
更改为 FALSE
后,您是否重新连接到实时 QuickBooks?
你需要,但看起来你没有……
我正在使用 QuickBooks PHP API。我创建了一些页面,它们都在使用我的 Sandbox 帐户。但是当我尝试为真实账户做同样的事情时,它给我错误。我在 config.php
中将变量 $sandbox=true 更改为 $sandbox=false下面是 itemchk.php
的代码<?php
//require_once dirname(__FILE__) . '/views/header.tpl.php';
header('Content-Type: text/xml');
$tokenval = '';
$customerkey = '';
$customersecreat = '';
if(isset($_POST['tokenval']) && $_POST['tokenval'] != ''){
$tokenval = $_POST['tokenval'];
}
if(isset($_POST['customerkey']) && $_POST['customerkey'] != ''){
$customerkey = $_POST['customerkey'];
}
if(isset($_POST['customersecreat']) && $_POST['customersecreat'] != ''){
$customersecreat = $_POST['customersecreat'];
}
$quers = "ItemChkQueryRs";
if(trim($tokenval) != "" && trim($customerkey) != "" && trim($customersecreat) != ""){
require_once dirname(__FILE__) . '/config1.php';
$ItemService = new QuickBooks_IPP_Service_Item();
if(isset($_POST['Itemname']) && $_POST['Itemname'] != ''){
$Itemname=$_POST['Itemname'];
$Items = $ItemService->query($Context, $realm, "SELECT * FROM Item where name='".$Itemname."' ");
if (count($Items)){
$status = 'Success';
$statuscode = '0';
$status_message = 'Item Exist';
$Item = $Items[0];
$txnid = $Item->getId();
$txnid = str_replace("{-", "", $txnid);
$txnid = str_replace("}", "", $txnid);
}
else{
$statuscode = '0';
$status_message = 'Item does not Exist';
}
}
else{
$statuscode = '1';
$status_message = 'Item Name Missing';
}
include_once "show_xml1.php";
}
else{
$statuscode = '1';
$status_message = 'Missing Authentication Details';
include_once "show_xml1.php";
}
?>
我在执行此页面时遇到的错误是
Notice: Undefined variable: Context in /home2/ultrasou/public_html/garg.com/quickbooks/ItemChk1.php on line 27
Notice: Undefined variable: realm in /home2/ultrasou/public_html/garg.com/quickbooks/ItemChk1.php on line 27
Fatal error: Call to a member function IPP() on a non-object in /home2/ultrasou/public_html/garg.com/quickbooks/QuickBooks/IPP/Service.php on line 829
将 $sandbox
更改为 FALSE
后,您是否重新连接到实时 QuickBooks?
你需要,但看起来你没有……