title: enabling curl extension in php for 000webhost.com
body: <p>So I'm trying to integrate my app with facebook and I'm using the default example.php's code as my index.php. I've changed the appID and appSecret to match my app's id and secret, whenever I test the code on facebook, it will throw an exception namely UnhandledCurlException. Wraping the code with try and catch will only return 0 whenever I call the getUser() method.</p>
  
  <p>I'm aware that I could enable the curl extension on php.ini, but I can only find that on my localhost but not on the server(000webhost.com) which I used to deploy my app. </p>
  
  <p>I've also heard that it's possible to use .htaccess file to explicitly modify the php configurations and hence enable the curl extension, anyone knows how to do that? or are there any other alternatives which I missed?</p>
  
  <p>This is the function that throws error:
      protected function makeRequest($url, $params, $ch=null) {
      if (!$ch) {
        $ch = curl_init();
      }</p>
  
  <pre><code>$opts = self::$CURL_OPTS;
  if ($this-&gt;getFileUploadSupport()) {
    $opts[CURLOPT_POSTFIELDS] = $params;
  } else {
    $opts[CURLOPT_POSTFIELDS] = http_build_query($params, null, '&amp;');
  }
  $opts[CURLOPT_URL] = $url;
  
  // disable the 'Expect: 100-continue' behaviour. This causes CURL to wait
  // for 2 seconds if the server does not support this header.
  if (isset($opts[CURLOPT_HTTPHEADER])) {
    $existing_headers = $opts[CURLOPT_HTTPHEADER];
    $existing_headers[] = 'Expect:';
    $opts[CURLOPT_HTTPHEADER] = $existing_headers;
  } else {
    $opts[CURLOPT_HTTPHEADER] = array('Expect:');
  }
  
  curl_setopt_array($ch, $opts);
  $result = curl_exec($ch);
  
  $errno = curl_errno($ch);
  // CURLE_SSL_CACERT || CURLE_SSL_CACERT_BADFILE
  if ($errno == 60 || $errno == 77) {
    self::errorLog('Invalid or no certificate authority found, '.
                   'using bundled information');
    curl_setopt($ch, CURLOPT_CAINFO,
                dirname(__FILE__) . DIRECTORY_SEPARATOR . 'fb_ca_chain_bundle.crt');
    $result = curl_exec($ch); //the line 1003
  }
  
  // With dual stacked DNS responses, it's possible for a server to
  // have IPv6 enabled but not have IPv6 connectivity.  If this is
  // the case, curl will try IPv4 first and if that fails, then it will
  // fall back to IPv6 and the error EHOSTUNREACH is returned by the
  // operating system.
  if ($result === false &amp;&amp; empty($opts[CURLOPT_IPRESOLVE])) {
      $matches = array();
      $regex = '/Failed to connect to ([^:].*): Network is unreachable/';
      if (preg_match($regex, curl_error($ch), $matches)) {
        if (strlen(@inet_pton($matches[1])) === 16) {
          self::errorLog('Invalid IPv6 configuration on server, '.
                         'Please disable or get native IPv6 on your server.');
          self::$CURL_OPTS[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
          curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
          $result = curl_exec($ch);
        }
      }
  }
  
  if ($result === false) {
    $e = new FacebookApiException(array(
      'error_code' =&gt; curl_errno($ch),
      'error' =&gt; array(
      'message' =&gt; curl_error($ch),
      'type' =&gt; 'CurlException',
      ),
    ));
    curl_close($ch);
    throw $e;
  }
  curl_close($ch);
  return $result;
  }
  </code></pre>