title: QuickBooks Desktop Web Connector Autorun a Request Queue
body: <p>I'm using quickbooks desktop. I want to dump the <code>CustomerQueryRq</code> response every 5 minutes. I started on top of ConsoliBYTE <code>docs/web_connector/example_app_web_connector</code></p>
  <hr />
  <h3>What I want to do:</h3>
  <p>I'm looking for a way where I don't have to visit the handler.php file every 5 minutes to trigger the queue. I believe there's a better way.</p>
  <hr />
  <h3>Here's what I did:</h3>
  <ol>
  <li>Created and registered a <code>.qwc</code> file in web connector</li>
  <li>Modified the config, qbwc, handler and functions files</li>
  <li>Created cron job that calls the handler.php file every 5 minutes.
  It gives me a json file like this: <a href="https://pastebin.com/2ztQbJcL" rel="nofollow noreferrer">json file</a> which is exactly what I want.</li>
  </ol>
  <p>qbwc.php:</p>
  <pre><code>require_once dirname(__FILE__) . '/config.php';
  require_once dirname(__FILE__) . '/functions.php';
  
  // Map QuickBooks actions to handler functions
  $map = array(
      QUICKBOOKS_QUERY_CUSTOMER =&gt; array( '_quickbooks_customer_query_request', '_quickbooks_customer_query_response' ),
      );
  
  $Server = new QuickBooks_WebConnector_Server($dsn, $map, $errmap, $hooks, $log_level, $soapserver, QUICKBOOKS_WSDL, $soap_options, $handler_options, $driver_options, $callback_options);
  $response = $Server-&gt;handle(true, true);
  </code></pre>
  <p>functions.php:</p>
  <pre><code>function _quickbooks_customer_query_request($ListID = null, $FullName = null)
  {
      $xml = '
      &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
          &lt;?qbxml version=&quot;2.0&quot;?&gt;
          &lt;QBXML&gt;
            &lt;QBXMLMsgsRq onError=&quot;continueOnError&quot;&gt;
              &lt;CustomerQueryRq /&gt;
            &lt;/QBXMLMsgsRq&gt;
          &lt;/QBXML&gt;
          ';
      return $xml;
  }
  
  function _quickbooks_customer_query_response($requestID, $user, $action, $ID, $extra, &amp;$err, $last_action_time, $last_actionident_time, $xml, $idents)
  {   
      $xmlData = simplexml_load_string($xml);
      $json = json_encode($xmlData-&gt;QBXMLMsgsRs-&gt;CustomerQueryRs, true);
      file_put_contents('customerDump.json', $json);
  }
  </code></pre>
  <p>handler.php:</p>
  <pre><code>require_once dirname(__FILE__) . '/config.php';
  
      // Queue up the customer dump
      $Queue = new QuickBooks_WebConnector_Queue($con);
      $Queue-&gt;enqueue(QUICKBOOKS_QUERY_CUSTOMER, 2);
      
      die('Great, queued up customer dump!');
  </code></pre>