码迷,mamicode.com
首页 > Web开发 > 详细

黄聪:wordpress如何携带cookie模拟浏览器访问网站

时间:2017-09-03 09:58:05      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:baidu   ica   image   5.0   like   url   gen   apple   如何   

$args = array(   
         ‘user-agent‘  => ‘Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36‘,
        ‘headers‘     => array( 
             ‘Accept‘  => ‘text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8‘,
             ‘Accept-Encoding‘  => ‘gzip, deflate, sdch, br‘,
             ‘Accept-Language‘  => ‘zh-CN,zh;q=0.8‘,
             ‘Cookie‘  => ‘BAIDUID=7C229AEE7415C1B2C54D81B726120004:FG=1; FP_UID=0a5ab4bc6eed1452ba9252a639c1f3e8; Hm_lvt_6859ce5aaf00fb00387e6434e4fcc925=1504360195; Hm_lpvt_6859ce5aaf00fb00387e6434e4fcc925=1504360564‘,
         )
    );
    $response = wp_remote_get( $url, $args );
    $html = $response[‘body‘];
    //$html = iconv( "GB2312", "UTF-8//IGNORE", $html );
    

 

黄聪:wordpress如何携带cookie模拟浏览器访问网站

标签:baidu   ica   image   5.0   like   url   gen   apple   如何   

原文地址:http://www.cnblogs.com/huangcong/p/7468712.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!