title: cURL not working on server but working on localhost
body: <p>I'm working on a small site on laravel and I retrieved some data from webservices and used it on my localhost and everything was fine then I uploaded it on the 3 of my server and all of them cannot send request.</p>
  
  <p>server 1 = <a href="http://testing2.vire-news.com/" rel="nofollow">http://testing2.vire-news.com/</a>    (host: godaddy)</p>
  
  <p>server 2 = <a href="http://testing.asmani.pk/" rel="nofollow">http://testing.asmani.pk/</a>         (host: hostgator)</p>
  
  <p>if you hit search it won't give you result from webservice.</p>
  
  <p>I have searched everything on stackoverflow put all kind of <code>CURLOPT_POST</code>,<code>CURLOPT_FOLLOWLOCATION</code> etc and nothing works out</p>
  
  <p>on Server 1 it gives error </p>
  
  <blockquote>
    <p>"Failed to connect to emexonline.com port 3000: Connection refused"</p>
  </blockquote>
  
  <p>on Server 2 it keeps connecting and then timed out.
  I made a simple php file of same code to test out of laravel environment and it's also not working.</p>
  
  <p>NOTE: I have tested other curl webservices like facebook and twitter APIs and they all are working fine on these servers and i have contacted the webservice providers and they are saying that everything is fine on their side and other customers are also using their webservice without any problem.</p>
  
  <p>Here's The code I have taken down the username and password from the XML data.
  Everything works fine on localhost and on server it gives error and all other functionality works fine only webservice is not connecting.</p>
  
  <pre><code>$xml_data = '&lt;?xml version="1.0" encoding="utf-8"?&gt;
          &lt;soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"&gt;
            &lt;soap12:Body&gt;
              &lt;SearchPart xmlns="http://emexonline.com:3000/MaximaWS/"&gt;
                &lt;Customer&gt;
                  &lt;UserName&gt;username&lt;/UserName&gt;
                  &lt;Password&gt;password&lt;/Password&gt;
                  &lt;SubCustomerId&gt;0&lt;/SubCustomerId&gt;
                  &lt;CustomerId&gt;20879&lt;/CustomerId&gt;
                &lt;/Customer&gt;
                &lt;DetailNum&gt;'.$Request-&gt;search.'&lt;/DetailNum&gt;
                &lt;ShowSubsts&gt;0&lt;/ShowSubsts&gt;
              &lt;/SearchPart&gt;
            &lt;/soap12:Body&gt;
          &lt;/soap12:Envelope&gt;
          ';
          $headers = array(
          "POST /MaximaWS/Service.asmx HTTP/1.1",
          "Host: emexonline.com",
          "Content-Type: application/soap+xml; charset=utf-8",
          "SOAPAction: \"http://dpd.com/common/service/LoginService/2.0/getAuth\"",
          "Content-Length: ".strlen($xml_data)
          );
  
          $url = 'http://emexonline.com:3000/MaximaWS/Service.asmx';
          $curll = curl_init();
          curl_setopt($curll, CURLOPT_URL,$url);
          curl_setopt($curll, CURLOPT_RETURNTRANSFER,1);
          curl_setopt($curll, CURLOPT_TIMEOUT, 30);
          curl_setopt($curll, CURLOPT_HTTPHEADER, $headers);
          curl_setopt($curll, CURLOPT_SSL_VERIFYPEER, FALSE);
          curl_setopt($curll, CURLOPT_POSTFIELDS, $xml_data);
          $reply = curl_exec($curll);
  </code></pre>
  
  <p>Well don't ask about get using <code>curl_errno($ch)</code>,<code>curl_error($ch)</code> and <code>curl_getinfo($ch)</code>, I have used them and got the results.</p>
  
  <p>Here's the result and info of successful localhost run</p>
  
  <pre><code>Array ( [url] =&gt; http://emexonline.com:3000/MaximaWS/service.wsdl [content_type] =&gt; text/html [http_code] =&gt; 405 [header_size] =&gt; 203 [request_size] =&gt; 834 [filetime] =&gt; -1 [ssl_verify_result] =&gt; 0 [redirect_count] =&gt; 0 [total_time] =&gt; 0.578 [namelookup_time] =&gt; 0.25 [connect_time] =&gt; 0.422 [pretransfer_time] =&gt; 0.422 [size_upload] =&gt; 617 [size_download] =&gt; 1293 [speed_download] =&gt; 2237 [speed_upload] =&gt; 1067 [download_content_length] =&gt; 1293 [upload_content_length] =&gt; 617 [starttransfer_time] =&gt; 0.578 [redirect_time] =&gt; 0 [redirect_url] =&gt; [primary_ip] =&gt; 86.98.88.87 [certinfo] =&gt; Array ( ) [primary_port] =&gt; 3000 [local_ip] =&gt; 192.168.0.102 [local_port] =&gt; 53325 )
  
  error: no error  
  </code></pre>
  
  <p>Here's the result and info of unsuccessful server run</p>
  
  <pre><code>Array ( [url] =&gt; http://emexonline.com/MaximaWS/Service.asmx [content_type] =&gt; [http_code] =&gt; 0 [header_size] =&gt; 0 [request_size] =&gt; 0 [filetime] =&gt; -1 [ssl_verify_result] =&gt; 0 [redirect_count] =&gt; 0 [total_time] =&gt; 30.001115 [namelookup_time] =&gt; 0.12449 [connect_time] =&gt; 0 [pretransfer_time] =&gt; 0 [size_upload] =&gt; 0 [size_download] =&gt; 0 [speed_download] =&gt; 0 [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; [certinfo] =&gt; Array ( ) [primary_port] =&gt; 0 [local_ip] =&gt; [local_port] =&gt; 0 ) 
  
  error: Connection timed out after 30001 milliseconds
  </code></pre>