How to obtain QQ information of QQ talents using PHP

Source: Internet
Author: User
This article mainly introduces how PHP obtains QQ information from QQ talents. The example analyzes the principles and implementation skills of php to obtain QQ information, which has some reference value, for more information, see the following example. Share it with you for your reference. The specific analysis is as follows:

Add the following:

① This is a simple routine. through expansion, you can easily obtain tens of millions of QQ information. The $ jsonUrl parameter cd = 610900 is the city code.
② QQ Daren information has been done anti-Leech, so the use of PHP refer to forge http://city.qq.com
③ I wanted to create a QQ mail group program, but it had no economic value. it was very easy to contribute to your reference.

The code is as follows:

The code is as follows:


<? Php
$ Refer = "http://city.qq.com"; // defines $ refer
$ Opt = array ('http' => array ('header' => "Referer: $ refer"); // an array of request headers
$ Context = stream_context_create ($ opt); // create a message text sending context header
$ 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); // call the JSON proxy function
Echo $ jsonStr; // output JSON text
// Obtain the JSON data of QQ talents
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 php programming.

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.