$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 );
时间: 2024-11-03 20:51:59