$headers = array(
//"Content-type:application/json;charset='utf-8'",
"Cache-Control:no-cache",
"Pragma:no-cache",
//"accept-charset:utf-8",
"Accept-Encoding:gzip",
"User-Agent:Dalvik/2.1.0 (Linux; U; Android 5.1.1;Build/LMY47V)",
"Host:www.domain.cn",
//'Transfer-Encoding:chunked', 压缩不能用这项
//"Content-Type:application/x-www-form-urlencoded",
//"Connection:Keep-Alive",
); /*
* 可写文件
$sourceFile="tmp.txt";
$fp = fopen($sourceFile, "w");
*/ $curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_ENCODING, 'gzip'); //curl解压gzip页面内容
curl_setopt($curl, CURLOPT_FORBID_REUSE, true);
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curl, CURLOPT_HTTPGET, true);
//curl_setopt($curl, CURLOPT_FILE, $fp);
$data = curl_exec($curl);
curl_close($curl); //file_put_contents('tmpdata.txt',$data);
echo bin2hex($data); //可查看下16进制
$ret = gzuncompress($data); print_r(json_decode($ret,true)

最新文章

  1. IIS中启用ASP并连接Access数据库的解决办法
  2. Asp.net MVC与Javascript
  3. js对象常用2中构造方法
  4. String类型中ToString hashCode equals compareTo等方法的经典实现
  5. 我的常用mixin 之 px
  6. <!DOCTYPE> 标签的深度剖析以及使用选择
  7. CodeKata
  8. (原)torch的apply函数
  9. 通用线程:POSIX 线程详解,第 3 部分 条件互斥量(pthread_cond_t)
  10. 为什么用IP无法访问网站,域名可以访问?
  11. Leetcode 4——Partition List
  12. 计蒜客NOIP2017提高组模拟赛(五)day2-成绩统计
  13. ES6 import and export
  14. java 生成txt文件
  15. 使用百度的富文本编辑器UEditor遇到的问题总结
  16. 从session中获取当前用户的工具类
  17. VM下如何装虚拟机?
  18. 【LG4169】[Violet]天使玩偶/SJY摆棋子
  19. 如何在Ubuntu 18.04上安装Go
  20. Redhat下 Apache, php, mysql的默认安装路径

热门文章

  1. SharePoint 2010:“&”作为SharePoint账号密码引起的错误
  2. Spring的Aspect切面类不能拦截Controller中的方法
  3. MyBatis返回Map键值对数据
  4. expdp和impdp 使用注意事项
  5. OneNET麒麟座应用开发之二:串口读取PM25传感器数据
  6. LeetCode(33):搜索旋转排序数组
  7. Java中强、软、弱、虚引用
  8. ZOJ 2314 Reactor Cooling(无源汇有上下界可行流)
  9. gcd,lcm
  10. 对象本田CRV