0
我試圖使用consoliByte PHP libray從Quickbook桌面獲得所有員工,但是它生成錯誤消息「0x80040400:解析提供的XML文本流時發現錯誤」如何使用PHP獲得Quickbooks中的所有員工
$attr_iteratorID = '';
$attr_iterator = ' iterator="Start" ';
if (empty($extra['iteratorID']))
{
// This is the first request in a new batch
$last = $this->_quickbooks_get_last_run($user, $action);
$this->_quickbooks_set_last_run($user, $action);
// Set the current run to $last
$this->_quickbooks_set_current_run($user, $action, $last);
}
else
{
// This is a continuation of a batch
$attr_iteratorID = ' iteratorID="' . $extra['iteratorID'] . '" ';
$attr_iterator = ' iterator="Continue" ';
$last = $this->_quickbooks_get_current_run($user, $action);
}
// Build the request
$xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="' . $version . '"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<EmployeeQueryRq metaData="ENUMTYPE" requestID="' . $requestID . '">
</EmployeeQueryRq>
</QBXMLMsgsRq>
</QBXML>';
return $xml;
如果我從XML刪除迭代器,然後它工作正常,我得到一個新的問題,我不能讓所有的員工,並顯示錯誤與無效ResponsXML錯誤 「QBWC1042:ReceiveResponseXML失敗」
$Parser = new QuickBooks_XML_Parser($xml);
//$this->db->insert('save_response', $arr);
if ($Doc = $Parser->parse($errnum, $errmsg))
{
$Root = $Doc->getRoot();
$List = $Root->getChildAt('QBXML/QBXMLMsgsRs/EmployeeQueryRs');
foreach ($List->children() as $Customer)
{
$arr = array(
'listid' => $Customer->getChildDataAt('EmployeeRet ListID'),
'timecreated' => $Customer->getChildDataAt('EmployeeRet TimeCreated'),
'timemodified' => $Customer->getChildDataAt('EmployeeRet TimeModified'),
'editsequence' => $Customer->getChildDataAt('EmployeeRet EditSequence'),
'name' => $Customer->getChildDataAt('EmployeeRet Name'),
'isactive' => $Customer->getChildDataAt('EmployeeRet IsActive'),
'salutation' => $Customer->getChildDataAt('EmployeeRet salutation'),
'firstname' => $Customer->getChildDataAt('EmployeeRet FirstName'),
'middlename' => $Customer->getChildDataAt('EmployeeRet MiddleName'),
'lastname' => $Customer->getChildDataAt('EmployeeRet LastName'),
'employeeaddress' =>$Customer->getChildDataAt('EmployeeRet EmployeeAddress Addr1'),
'city' =>$Customer->getChildDataAt('EmployeeRet EmployeeAddress City'),
'state' =>$Customer->getChildDataAt('EmployeeRet EmployeeAddress State'),
'postalcode' =>$Customer->getChildDataAt('EmployeeRet EmployeeAddress PostalCode'),
'employeetype' => $Customer->getChildDataAt('EmployeeRet EmployeeType'),
'birthdate' => $Customer->getChildDataAt('EmployeeRet BirthDate'),
'hireddate' => $Customer->getChildDataAt('EmployeeRet HiredDate'),
);
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, 'Importing employee ' . $arr['name'] . ': ' . print_r($arr, true));
$result = $this->db->insert('quickbook_employee', $arr);
}
}
return true;
。可以任何人都可以讓我知道我錯在哪裏。
在此先感謝
是的,我檢查了PHP日誌,但沒有錯誤。和我已經確認與PHP或SQL錯誤,但沒有發現錯誤以及:) –
然後,你需要發佈你的代碼的其餘部分,並確保你的PHP錯誤日誌實際上工作。 –