赞
踩
[PHP] 纯文本查看 复制代码pre(cget("http://www.miguvideo.com/wap/resource/migu/detail/Detail.jsp?cid=629484832"));
function pre($t){
header("Content-type:text/html;charset=utf-8");
echo "
";
var_dump($t);
// echo $t;
}
function cget($url, $cookies = '', $post = '')
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_HEADER, 1); //输出header信息
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);//location跟随
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); //规避HTTP 100
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //规避证书
if ($post) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
if ($cookies) {
curl_setopt($ch, CURLOPT_COOKIE, $cookies);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$re = curl_exec($ch);
curl_close($ch);
return $re;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。