title: PHP: CURL is enabled but has no effect
body: <p>I'm trying to get data from external website using <code>cURL</code> in <code>PHP</code> but, somehow it's not working.
  <br/><br/>I've checked out that <code>CURL</code> enable in <code>phpinfo()</code>. It shows <code>cURL</code> is enabled <a href="https://i.stack.imgur.com/diPiM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/diPiM.png" alt="cURL is enabled"></a></p>
  
  <p>But, my code is not working.</p>
  
  <pre><code>&lt;?php
  if (! function_exists ( 'curl_version' )) {
      exit ( "Enable cURL in PHP" );
  }
  
  $ch = curl_init ();
  $timeout = 0; // 100; // set to zero for no timeout
  $myHITurl = "http://www.google.com";
  curl_setopt ( $ch, CURLOPT_URL, $myHITurl );
  curl_setopt ( $ch, CURLOPT_HEADER, 0 );
  curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
  curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
  $file_contents = curl_exec ( $ch );
  if (curl_errno ( $ch )) {
      echo curl_error ( $ch );
      curl_close ( $ch );
      exit ();
  }
  curl_close ( $ch );
  
  // dump output of api if you want during test
  echo "$file_contents";
  ?&gt;
  </code></pre>
  
  <p><br/>It goes timeout.<br/>
  <a href="https://i.stack.imgur.com/qGos9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qGos9.png" alt="Connection Timeout"></a></p>
  
  <p>I'm not using WAMP or XAMPP server. The above code runs directly on the server.
  I've no idea what's going wrong.</p>