How I can get all employee from Quickbooks with PHP -
i trying employee quickbook desktop using consolibyte php libray, generate error "0x80040400: quickbooks found error when parsing provided xml text stream.
$attr_iteratorid = ''; $attr_iterator = ' iterator="start" '; if (empty($extra['iteratorid'])) { // first request in new batch $last = $this->_quickbooks_get_last_run($user, $action); $this->_quickbooks_set_last_run($user, $action); // set current run $last $this->_quickbooks_set_current_run($user, $action, $last); } else { // continuation of batch $attr_iteratorid = ' iteratorid="' . $extra['iteratorid'] . '" '; $attr_iterator = ' iterator="continue" '; $last = $this->_quickbooks_get_current_run($user, $action); } // build 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;
if remove iterator xml works fine , new issue cannot employees , displays error invalid responsxml error "qbwc1042: receiveresponsexml failed".
$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() $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;
can let me know wrong.
thanks in advance
if refer documentation:
you'll note employeequery
not support iterators. so, remove iterator.
this error:
qbwc1042: receiveresponsexml failed
99.9% of time means have php or sql error in code. specifically, in response handler function.
unfortunately, didn't post enough code have can test with, no 1 going able tell actual error is.
did check php error log?
Comments
Post a Comment