Home > php教程 > PHP源码 > PHP获取QQ达人QQ信息

PHP获取QQ达人QQ信息

PHP中文网
Release: 2016-05-25 17:15:52
Original
1338 people have browsed it

代码

<?php
/*
@ 获取QQ达人QQ信息 
@ 起点岁月 2010-09-06
@ 一个简单的例程,通过扩展可以轻松获取千万级别QQ信息,$jsonUrl 参数cd=610900 为城市代码
@ QQ达人信息已经做防盗链了,所以在此用到PHP的refer去伪造 http://city.qq.com@ 本来想做一个QQ邮件群发软件玩玩,但是没有经济价值呵呵,贡献出来大家参考,很简单。
*/
$refer="http://city.qq.com"; //定义$refer
$opt=array(&#39;http&#39;=>array(&#39;header&#39;=>"Referer: $refer")); //请求头部数组
$context=stream_context_create($opt); //创建一个发送上下文头部信息文本
$jsonUrl ="http://city.qq.com/json.php?mod=search&act=page&callback=showSrchResult&jsontype=str&perpage=10&cd=610900&nl=3&xb=0&type=city&pg=1";
$jsonStr = getJson($jsonUrl,$refer,$context); //调用JSON代理函数
echo $jsonStr; //输出JSON文本
//获取QQ达人JSON数据
function getJson($url,$referer,$context)
{
        $opt=array(&#39;http&#39;=>array(&#39;header&#39;=>"Referer: $referer")); 
        $context=stream_context_create( $opt);
        $getJsonStr = file_get_contents( $url,false, $context); 
   $getJsonStr = substr($getJsonStr,0,-2);
   $getJsonStr = substr($getJsonStr,15);
  
   return $getJsonStr;
}
?>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template