title: why this php cURL function can't work
body: <pre><code>function get_data($url) {
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
  }
  </code></pre>
  
  <p>i find this function from the internet. when i test it in a php file using this code <code>$returned_content = get_data('http://google.com');</code> but it can't work.and get a "301 Moved Permanently" The document has moved here.   error. why?</p>