<?php

ini_set('display_errors', true);
error_reporting(E_ALL | E_STRICT);
require '/Users/kpalmer/Projects/QuickBooks/QuickBooks.php';
$Parser = new QuickBooks_IPP_Parser();
$response = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CompanyMetaData xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo"><QBNRegisteredCompanyName>Rock Castle Construction</QBNRegisteredCompanyName><Address><Line1>1735 County Road</Line1><City>South Jordan</City><CountrySubDivisionCode>UT</CountrySubDivisionCode><PostalCode>84095</PostalCode><Tag>COMPANY_ADDRESS</Tag></Address><Phone><FreeFormNumber>(801)654-4568</FreeFormNumber></Phone><Email><Address>noah.goodrich+intuit@lendio.com</Address><Tag>COMPANY_EMAIL</Tag></Email><LegalAddress><Line1>1735 County Road</Line1><City>South Jordan</City><CountrySubDivisionCode>UT</CountrySubDivisionCode><PostalCode>84095</PostalCode><Tag>LEGAL_ADDRESS</Tag></LegalAddress><IndustryType>Other Nonprofit or Exempt Organization</IndustryType></CompanyMetaData>';
$xml_errnum = null;
$xml_errmsg = null;
$err_code = null;
$err_desc = null;
$err_db = null;
$parsed = $Parser->parseIDS($response, QuickBooks_IPP_IDS::OPTYPE_FINDBYID, $xml_errnum, $xml_errmsg, $err_code, $err_desc, $err_db);
print_r($parsed);
			<Id idDomain="QB">00000000000000rp</Id>
			<DeviceType>LandLine</DeviceType>
			<FreeFormNumber>860-634-1602</FreeFormNumber>
			<Default>1</Default>
			<Tag>Business</Tag>
		</Phone>
		<Title>Mr.</Title>
		<GivenName>Keith</GivenName>
		<FamilyName>Palmer</FamilyName>
		<DBAName>Test Customer 1, LLC</DBAName>
		<Active>true</Active>
		<ShowAs>Test Customer 1</ShowAs>
		<OpenBalance>
			<CurrencyCode>USD</CurrencyCode>
			<Amount>250</Amount>
		</OpenBalance>
		<OpenBalanceDate>2010-04-07</OpenBalanceDate>
	</Customer>

</Customers></RestResponse>';
$Parser = new QuickBooks_IPP_Parser();
$optype = QuickBooks_IPP_IDS::OPTYPE_QUERY;
$xml_errnum = null;
$xml_errmsg = null;
$err_code = null;
$err_desc = null;
$err_db = null;
$list = $Parser->parseIDS($xml, $optype, $xml_errnum, $xml_errmsg, $err_code, $err_desc, $err_db);
foreach ($list as $Customer) {
    print $Customer->getName() . ' has an ID of: ' . $Customer->getId() . ', ' . $Customer->getAddress(0)->getId() . "\n";
}