title: Using curl to get data from a website
body: <p>I am trying to use cURL to get train information from <a href="http://www.indianrail.gov.in/know_Station_Code.html" rel="nofollow">http://www.indianrail.gov.in/know_Station_Code.html</a> .<br><br>
  I have the following PHP code :</p>
  
  <pre><code>&lt;?php
  $fields = array(
              'lccp_src_stncode_dis'=&gt;'MANGAPATNAM-+MUM',
              'lccp_src_stncode'=&gt;'MUM',
              'lccp_dstn_stncode_dis‌'=&gt;'AMBALA+CITY-+UBC',
              'lccp_dstn_stncode'=&gt;'UBC',
              'lccp_classopt'=&gt;'SL',
              'lccp_day'=&gt;'17',
              'lccp_month'=&gt;'8',
              'CurrentMonth'=&gt;'7',
              'CurrentDate'=&gt;'17',
              'CurrentYear'=&gt;'2015'
          );
  
  $fields_string = '';         //defining an empty string
  foreach($fields as $key=&gt;$value) { 
      $temp = $key.'='.$value.'&amp;'; 
      $fields_string.$temp;
  }
  rtrim($fields_string,'&amp;');      //removing the last '&amp;' from the generated string
  
  $curl = curl_init('http://www.indianrail.gov.in/cgi_bin/inet_srcdest_cgi_date.cgi');
  curl_setopt($curl,CURLOPT_POST,1);
  curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($curl,CURLOPT_POSTFIELDS,$fields_string);
  
  $result = curl_exec($curl);
  var_dump($result);
  ?&gt;
  </code></pre>
  
  <p>The problem is that I get this output on my browser window :</p>
  
  <pre><code>boolean false
  </code></pre>
  
  <p>I tried using <code>var_dump(curl_error($curl))</code> and I got the following output :</p>
  
  <pre><code>string 'Empty reply from server' (length=23)
  </code></pre>
  
  <p>Thanks for any help.</p>