title: PHP curl Connection timed out error
body: <p>I am calling an API using curl in PHP, Sometimes it works fine and sometimes I get <code>Failed to connect to api-domain.com port 80: Connection timed out</code></p>
  <p>It's a little strange that sometimes it's working and sometimes it's not. To troubleshoot the issue I have printed the <code>curl_getinfo()</code> when it is not working, please check it below.</p>
  <p>It's showing connect time = 0 and total time = 130 sec, I am not really sure what it means. If any one has good understanding about it please review the below log and help me understand what the exact issue is.</p>
  <pre><code>[url] =&gt; http://api-domain.com/?act=get_story_banners
  [content_type] =&gt; text/html; charset=UTF-8
  [http_code] =&gt; 200
  [header_size] =&gt; 630
  [req   uest_size] =&gt; 283
  [filetime] =&gt; -1
  [ssl_verify_result] =&gt; 0
  [redirect_count] =&gt; 0
  [total_time] =&gt; 130.335916
  [namelookup_time] =&gt; 0.000016
  [connect_time] =&gt; 0
  [pretransfer_time] =&gt; 0
  [size_upload] =&gt; 0
  [size_download] =&gt; 744
  [speed_download] =&gt; 13814
  [speed_upload] =&gt; 0
  [download_content_length] =&gt; -1
  [upload_content_length] =&gt; -1
  [starttransfer_time] =&gt; 0
  [redirect_time] =&gt; 0
  [redirect_url] =&gt; 
  [primary_ip] =&gt; 34.231.133.7
  [certinfo] =&gt; Array()
  [primary_port] =&gt; 80
  [local_ip] =&gt; xxx.xxx.xxx.xxx
  [local_port] =&gt; 48080
  </code></pre>
  <p>Thank in advance!</p>
  <h1>Edit</h1>
  <p>Sometimes curl request comes to the REST API Server and sometimes it doesn't. It is discarded at connection level itself, does not reach to the REST API server. I am little confused as to why sometimes it connects and sometimes it doesn't.</p>