漂定

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
function getURLToData($url){
    $HTTP_Server = $url;
    $ch = curl_init();
    curl_setopt ($ch,CURLOPT_URL,$HTTP_Server);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);
    curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; MI 2S Build/JRO03L) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 XiaoMi/MiuiBrowser/1.0");
    $res = curl_exec($ch);
    curl_close ($ch);
    return $res;
}

echo getURLToData('http://info.3g.qq.com/');

 

posted on 2013-09-05 16:12  漂定  阅读(1477)  评论(0编辑  收藏  举报