PHP to get QQ talent QQ Information method, PHP access
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:
Copy the Code code as follows:
<?php
$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/963846.html www.bkjia.com true http://www.bkjia.com/PHPjc/963846.html techarticle PHP to get QQ talent QQ information method, PHP Get the example of this article about PHP to get QQ QQ information method. Share to everyone for your reference. The specific analysis is as follows: Add the following points: ...