title: Getting 500 internal server error while using curl
body: <p>I am using two curl for autosuggest and fetching records.when i tested the same code on local its working fine but when i take it live gets 500 intenal server please look into this.</p>
  
  <pre><code>switch ($cases){
  case 'city' :
      $obj_biz_tmp_info= new info($db_server['CITY']);
      $response_list = $obj_biz_tmp_info-&gt;getCity($string);
      $obj_biz_tmp_info-&gt;close();
      break;
  
  case 'what' :
      if ($_GET['search'] == "") return false;
  
      $areasrch = $_GET['search'];
  
      if(!empty($areasrch)){
          $apiurl = 'http://192.168.1.97/auto.php?search='.urlencode(trim($areasrch)).'&amp;city='.urlencode(trim($city)).'&amp;stp=0&amp;dtres=20&amp;srch_type=2';
          $ch = curl_init($apiurl);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($ch, CURLOPT_USERPWD, "abcd");
          curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
          $getResults = curl_exec($ch);
          curl_close($ch);
          $getResults = json_decode($getResults,true);
  
          echo json_encode($getResults);      
          //print_r($getResults);
  
          break;
      }
  
  case 'compsearch':
  
      if ($_GET['search'] == "") return false;
  
      $areasrch1 = $_GET['search'];
  
      if(!empty($areasrch1)){
          $apiurl = 'http://192.168.1.97/auto.php?search='.urlencode(trim($areasrch1)).'&amp;city='.urlencode(trim($city)).'&amp;stp=0&amp;dtres=20&amp;srch_type=2';
  
          $ch = curl_init($apiurl);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($ch, CURLOPT_USERPWD, "abcd");
          curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
          $getResults1 = curl_exec($ch);
          curl_close($ch);
          $getResults1 = json_decode($getResults1,true);
          echo json_encode($getResults1);
  
          //print_r($getResults1);
  
          break;
      }
  </code></pre>