PHP to get QQ talent QQ Information method

Source: Internet
Author: User
Tags json

This article mainly introduces the PHP access QQ QQ Information method, example analysis of PHP access to QQ information and the principle of the corresponding implementation skills, with a certain reference value, the need for friends can refer to the

-->

This article is an example of PHP to obtain QQ talent QQ information method. 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 up to the information has done anti-theft chain, so in this use of PHP refer to forge http://city.qq.com
③ originally wanted to do a mass QQ mail software to play, but no economic value oh, contribute to come out for everyone's reference, very simple.

The specific code is as follows:

The code is 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 text that sends a context header message
$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 will help you with your PHP program design.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.