title: Send HTTP request from PHP without waiting for response?
body: <p>I want to have an HTTP GET request sent from PHP. Example:</p>
  
  <pre><code>http://tracker.example.com?product_number=5230&amp;price=123.52
  </code></pre>
  
  <p>The idea is to do server-side web-analytics: Instead of sending tracking
  information from JavaScript to a server, the server sends tracking
  information directly to another server.</p>
  
  <p>Requirements:</p>
  
  <ul>
  <li><p>The request should take as little time as possible, in order to not
  noticeably delay processing of the PHP page.</p></li>
  <li><p>The response from the <code>tracker.example.com</code> does not need to be
  checked. As examples, some possible responses from
  <code>tracker.example.com</code>:</p>
  
  <ul>
  <li><p><em>200:</em> That's fine, but no need to check that.</p></li>
  <li><p><em>404:</em> Bad luck, but - again - no need to check that.</p></li>
  <li><p><em>301:</em> Although a redirect would be appropriate, it would delay
  processing of the PHP page, so don't do that.</p></li>
  </ul>
  
  <p>In short: <em>All</em> responses can be discarded.</p></li>
  </ul>
  
  <p>Ideas for solutions:</p>
  
  <ul>
  <li><p>In a now deleted answer, someone suggested calling command line
  <a href="http://en.wikipedia.org/wiki/CURL">curl</a> from PHP in a shell process. This seems like a good idea,
  only that I don't know if forking a lot of shell processes under
  heavy load is a wise thing to do.</p></li>
  <li><p>I found <a href="http://code.google.com/p/php-ga/">php-ga</a>, a package for doing server-side Google
  Analytics from PHP. On the project's page, it is
  mentioned: <em>"Can be configured to [...] use non-blocking requests."</em>
  So far I haven't found the time to investigate what method php-ga
  uses internally, but this method could be it!</p></li>
  </ul>
  
  <p>In a nutshell: What is the best solution to do generic server-side
  tracking/analytics from PHP.</p>