title: cURL error 28 - Connection timed out after x milliseconds
body: <p>Yep. I know there is some alike questions about this err but i was read all of this and it not resolve my problem so:</p>
  
  <p>My php code:</p>
  
  <pre><code>    $url = 'example.domain.com/path/file.php'
      $string = 'param=5';
  
      $ch = curl_init();
  
      // CURL options
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Content-Length: ' . strlen($string)));
      curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
  
      return curl_exec($ch);
  </code></pre>
  
  <p>I check errors this way:</p>
  
  <pre><code>$curl_errno = curl_errno($ch);
  $curl_error = curl_error($ch);
  
   if($curl_errno &gt; 0) {
     echo "cURL Error ($curl_errno): $curl_error\n";
   } 
  </code></pre>
  
  <p><code>$curl_errorno</code> is 28 and
  <code>curl_error</code> is Connection timed out after 10001 milliseconds</p>
  
  <p>Please help or get some clue what I can check.</p>
  
  <p><strong>from localhost or other server is it also working (curl or file_get_content)... is there any hint?</strong></p>
  
  <ul>
  <li>from local machine i get cURL ok response via php ~4sec </li>
  <li>from server (host server) shell i get error 7 failed to connect to example.domain.com port 80: connection timed out</li>
  <li>if in php try <code>file_get_contents</code> (from host server) - no response</li>
  <li>URL - is accessible from browser (direct php file)</li>
  <li>If i create <code>ajax</code> request - response is ok</li>
  <li>If i trying add to url http or https - always same error</li>
  <li>if i trying set limit to 30 sec. same result</li>
  </ul>