title: Circumventing issue with connecting to IPv6 host via cURL
body: <p>I have an application I distribute for a PHP-based CMS which connects to Google services via cURL. Lately (since Google moved to IPv6 in June), I've had some reports of extremely slow connection times (150 seconds in one case), or lack of connectivity altogether (Example curl error: Failed to connect to 2001:4860:b007::5F: Network is unreachable).</p>
  
  <p>I've found, via SO and other resources, that forcing curl to use IPv4 fixes these issues:</p>
  
  <pre><code>if(defined('CURLOPT_IPRESOLVE') &amp;&amp; defined('CURL_IPRESOLVE_V4'))
  {
      curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
  }   
  </code></pre>
  
  <p>My guess is that the servers these requests are being made from are misconfigured (perhaps saying they support IPv6 when they really don't?). But I'm fairly ignorant of the intricacies of IPv6 responses to DNS lookups.</p>
  
  <p>By forcing IPv4, and I setting myself up for errors on servers which <em>are</em> properly configured?</p>
  
  <p>Is there a robust method I can use to check for compatibility, and set my cURL options accordingly?</p>