How to get QQ QQ information by PHP
This article mainly introduces the method of getting QQ QQ information by PHP, the example analyzes the principle and corresponding implementation skills of PHP to get QQ information, it has a certain reference value, the need of friends can refer to the following
The example of this article describes how to get the QQ QQ information by PHP. Share to everyone for your reference. The specific analysis is as follows:
Add the following points:
① This is a simple routine, through the extension can easily get Tens QQ information, $JSONURL parameters cd=610900 for the city code
②QQ The talent information has been done anti-theft chain, so the use of PHP refer to forge http://city.qq.com
③ originally wanted to do a QQ mail mass software to play, but no economic value, hehe, contribute to everyone reference, very simple.
The specific code is as follows:
The code is as follows:
$refer = "http://city.qq.com"; Define $refer
$opt =array (' http ' =>array (' header ' = ' "Referer: $refer")); Request Header Array
$context =stream_context_create ($opt); Create a Send context header message text
$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); Calling the JSON proxy function
Echo $jsonStr; Output JSON text
Get QQ Talent JSON data
function Getjson ($url, $referer, $context)
{
$opt =array (' http ' =>array (' header ' = ' "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;
}
?>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/963988.html www.bkjia.com true http://www.bkjia.com/PHPjc/963988.html techarticle The method of getting QQ QQ information by PHP This article mainly introduces the method of getting QQ QQ information by PHP, the example analyzes the principle and corresponding realization skill of PHP to get QQ information, and has certain reference borrowing ...