//
$API = new QuickBooks_API($api_driver_dsn, $user, $source_type, $source_dsn, $api_options, $source_options, $driver_options);
// Get the complete list of "Customers" from QuickBooks
//
// Unfortunately, non-US versions of QuickBooks do not yet support the use of
//	"iterators" to break up the response from QuickBooks into many smaller
//	chunks. So, if we ask for the complete customer list, the response is so
//	large that the transfer takes a long time, the Web Connector times out, or
//	the HTTP server throws an error after receiving to much data.
//
//	Thus, instead of sending just a single request, we're going to fetch the
//	list of customers by date range instead.
$seconds_in_a_day = 60 * 60 * 24;
for ($i = strtotime('2009-04-07'); $i < time(); $i = $i + $seconds_in_a_day) {
    $search = array('FromModifiedDate' => QuickBooks_Utilities::datetime($i), 'ToModifiedDate' => QuickBooks_Utilities::datetime($i + $seconds_in_a_day));
    if ($API->searchCustomers($search, '_quickbooks_ca_customer_search_callback')) {
        print 'Fetch customers from: ' . $search['FromModifiedDate'] . ' to ' . $search['ToModifiedDate'] . "\n";
    }
}
// Get a complete list of "Invoices" from QuickBooks
$seconds_in_a_day = 60 * 60 * 24;
for ($i = strtotime('2009-04-07'); $i < time(); $i = $i + $seconds_in_a_day) {
    $search = array('ModifiedDateRangeFilter FromModifiedDate' => QuickBooks_Utilities::datetime($i), 'ModifiedDateRangeFilter ToModifiedDate' => QuickBooks_Utilities::datetime($i + $seconds_in_a_day));
    if ($API->searchInvoices($search, '_quickbooks_ca_invoice_search_callback')) {
        print 'Fetch invoices from: ' . $search['ModifiedDateRangeFilter FromModifiedDate'] . ' to ' . $search['ModifiedDateRangeFilter ToModifiedDate'] . "\n";
    }
}
// Fetch a specific customer from QuickBooks by Name
//
// We're going to query QuickBooks for a customer named "Keith Palmer".
//	The query will be executed against QuickBooks and the function named