title: Fatal error: Uncaught CurlException: 7 can't connect to Facebook Graph API
body: <p>I'm struggling to access Facebook's Graph API (I am on WAMP, Apache 2.4.4, PHP 5.4.12) and get that Curl error:</p>
  
  <pre><code>Fatal error: Uncaught CurlException: 7: Failed connect to graph.facebook.com:443; No error thrown in base_facebook.php on line 994
  </code></pre>
  
  <p>First, my code, then what I tried:</p>
  
  <pre><code>$facebook = new Facebook($config);
  $uid = $facebook-&gt;getUser();
  $user_profile = $facebook-&gt;api('/me','GET');
  echo $user_profile['name'];
  </code></pre>
  
  <p>I don't give anything since it's not relevant, I successfully connect with Javascript, using <a href="https://developers.facebook.com/docs/facebook-login/getting-started-web/" rel="nofollow" title="Facebook's login code">Facebook's code</a>. I am then connected.</p>
  
  <pre><code>$facebook = new Facebook($config);
  $uid = $facebook-&gt;getUser();
  </code></pre>
  
  <p>These two lines work without problem, I'm connected, and if I echo the user id it corresponds to the one found using the web graph tool.</p>
  
  <p>The problem comes from the $facebook->api which gives the error. I got rid of the timeout problems (by increasing both curl and Apache's time (I'm at 300 sec)). Curl is installed (I had to used it before and phpinfo shows it running). I also checked the IPV4/IPV6 problem, I asked Apache to only listen 0.0.0.0:80 and forced CURL to only use IPV4:</p>
  
  <pre><code>curl_setopt( $ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
  </code></pre>
  
  <p>Finally, I checked the port 80, which seems to be listened by my Apache (the test port 80 of Apache says it's used by "Server: Apache/2.4.4 (Win64) PHP/5.4.12). Perhaps there's another problem with that port (it's the thing I know the less about), but WAMP seems to work fine, and I still manage to connect to Facebook with my page.</p>
  
  <p>Anybody got any clue? Because I have the feeling that I tried every solution I found so far, both on Stackoverflow and Google.</p>
  
  <p>Have a good day,
  Morphilos</p>