title: PHP CURL Error 7 failed to connect to host
body: <p>I have a peculiar problem i am facing with Php CURL . </p>
  
  <p>I am trying to call a web service running on a windows machine within the same network via a php script running on a centos workstation. I am using CURL. The problem is that i can access the URL with the browser and it works perfectly. BUt when i try to use the php script it gives an error code 7 . </p>
  
  <p>HOwever if i try a local ip address and google in the php script it works with no issues. What could be the issue? I have been trying to get me head around this issue for the past few hours but i am not able to sort it. </p>
  
  <p>I would also like to add, when i use crl via the terminal i get a proper reply. HTTP 200OK</p>
  
  <p>Help Required :) </p>
  
  <pre><code>$curl = curl_init();
  curl_setopt_array($curl, array( 
     CURLOPT_RETURNTRANSFER =&gt; 1,
     CURLOPT_HEADER =&gt; 1,
     CURLOPT_TIMEOUT =&gt; 4,
     CURLOPT_USERAGENT=&gt;'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13',
     CURLOPT_VERBOSE =&gt; 1,
     CURLOPT_PORT =&gt; 9710,          
     CURLOPT_URL =&gt; 'http://192.168.100.4:9710/http/send-message?message='.$message
  ));
  
  // Send the request &amp; save response to $resp
  $resp = curl_exec($curl);
  echo "&lt;br&gt;Error Code : " .curl_errno($curl); 
  </code></pre>