title: cURL gives Couldn't resolve host
body: <p>I am on my new dedicated server and i am gettin error on curl connections.</p>
  
  <p>I tried that one </p>
  
  <pre><code>$_h = curl_init(); 
  curl_setopt($_h, CURLOPT_HEADER, 1); 
  curl_setopt($_h, CURLOPT_RETURNTRANSFER, 1); 
  curl_setopt($_h, CURLOPT_HTTPGET, 1); 
  curl_setopt($_h, CURLOPT_URL, 'http://api.beatport.com/catalog/labels/detail?id=14248&amp;format=json&amp;v=1.0' ); 
  curl_setopt($_h, CURLOPT_DNS_USE_GLOBAL_CACHE, false ); 
  curl_setopt($_h, CURLOPT_DNS_CACHE_TIMEOUT, 2 ); 
  var_dump(curl_exec($_h)); 
  var_dump(curl_getinfo($_h)); 
  var_dump(curl_error($_h)); 
  </code></pre>
  
  <p>and i got</p>
  
  <pre><code>bool(false) array(21) { ["url"]=&gt; string(72) "http://api.beatport.com/catalog/labels/detail?id=14248&amp;format=json&amp;v=1.0" ["content_type"]=&gt; NULL ["http_code"]=&gt; int(0) ["header_size"]=&gt; int(0) ["request_size"]=&gt; int(0) ["filetime"]=&gt; int(-1) ["ssl_verify_result"]=&gt; int(0) ["redirect_count"]=&gt; int(0) ["total_time"]=&gt; float(0) ["namelookup_time"]=&gt; float(0) ["connect_time"]=&gt; float(0) ["pretransfer_time"]=&gt; float(0) ["size_upload"]=&gt; float(0) ["size_download"]=&gt; float(0) ["speed_download"]=&gt; float(0) ["speed_upload"]=&gt; float(0) ["download_content_length"]=&gt; float(-1) ["upload_content_length"]=&gt; float(-1) ["starttransfer_time"]=&gt; float(0) ["redirect_time"]=&gt; float(0) ["certinfo"]=&gt; array(0) { } } string(40) "Couldn't resolve host 'api.beatport.com'"
  </code></pre>
  
  <p>that may be a DNS issue ?</p>
  
  <p>SOLVED:</p>
  
  <p>i opened /etc/hosts and added the ip of the website that i want to retrieve via curl and it worked !</p>