title: cUrl error: "Couldn't resolve host 'search.twitter.com' "
body: <p>When trying to connect to the Twitter api using cUrl and PHP, I get the following error:</p>
  
  <p>Couldn't resolve host 'search.twitter.com'</p>
  
  <p>Before it worked fine, and the request works in my browser. When trying to connect to example.com, I do get the page. I've also tried the following code, with which I get the same error:</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://www.example.com' );
  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>Could this be a DNS issue? Are there any other options for fetching JSON data with PHP?</p>
  
  <p>EDIT: This is the code that got an error initially:</p>
  
  <pre><code>$json_url = "https://search.twitter.com/search.json?q=" . 'bitterrific' . "&amp;rpp=10&amp;result_type=all";
      $ch = curl_init();
      $timeout = 100;
      curl_setopt($ch,CURLOPT_URL,$json_url);
      curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
      curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
      $data = curl_exec($ch);
      //curl_close($ch);
      $content = json_decode($data);
      $output = array();
      echo "DATA: ".curl_error($ch);
  </code></pre>
  
  <p>Thanks!</p>