哪位高手知道如何把这个链接的页面内容提取出来?http://202.108.23.172/m?ct=134217728&tn=baidusg,一生有你 &word=mp3,http://xmwt.stu.com.cn/music/modern/qpumnJqksKemoJw0.mp3,,[%D2%BB%C9%FA%D3%D0%C4%E3+%CB%AE%C4%BE%C4%EA%BB%AA]&lm=16777216我用file_get_contents函数抓取,提示下面错误:Warning: file_get_contents(http://202.108.23.172/m?ct=134217728&tn=baidusg,一生有你 &word=mp3,http://xmwt.stu.com.cn/music/modern/qpumnJqksKemoJw0.mp3,,[%D2%BB%C9%FA%D3%D0%C4%E3+%CB%AE%C4%BE%C4%EA%BB%AA]&lm=16777216) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in e:\wwwroot\music\wwwroot\test.php on line 3 应该对这个链接如何处理才能抓取到这个链接的内容?
应该对这个链接如何处理才能抓取到这个链接的内容?
$handle = file_get_contents("http://202.108.23.172/m?ct=134217728&tn=baidusg,".urlencode("一生有你")." &word=mp3,http://xmwt.stu.com.cn/music/modern/qpumnJqksKemoJw0.mp3,,[%D2%BB%C9%FA%D3%D0%C4%E3+%CB%AE%C4%BE%C4%EA%BB%AA]&lm=16777216");
echo $handle;
?> 这样也不行呀
//$header[] = "Accept: text/vnd.wap.wml,*.*";
$user_agent = "Mozilla/4.0";
$follow_loc = 1;
$cookie_file ="/tmp/cook.txt";
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_URL, $url);
@curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
@curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
@curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
@curl_setopt($ch, CURLOPT_HEADER, $header);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $follow_loc);
@curl_setopt($ch, CURLOPT_TIMEOUT, 1000);if (trim($post_data)!= '') {
@curl_setopt($ch, CURLOPT_POST, 1);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}$result = @curl_exec($ch);
@curl_close($ch);
return $result;
}