Php implements the QQ space to get the user name of the current user and generate an image. _ PHP Tutorial

Source: Internet
Author: User
Php implements the QQ space to get the user name of the current user and generate an image ,. Php implements the QQ space to get the user name of the current user and generate an image. this example describes how php implements the QQ space to get the user name of the current user and generate an image. I will share with you how to use php to obtain the user name and generate an image of the current user in the QQ space,

This example describes how to use php to obtain the user name of the current user and generate an image in the QQ space. Share it with you for your reference. The details are as follows:

Recently, I found that some images containing the nickname and QQ number of the current user are often reprinted in the space. I am curious and have studied the principle.
The principle is very simple. images are generated using php. okay, go to the code directly.

Image source code:

<?php$ment = $_SERVER["HTTP_REFERER"];if($ment == 'http://cnc.qzs.qq.com/qzone/newblog/v5/editor.html'){  header("HTTP/1.0 500 Internal Server Error");exit;}preg_match("#[0-9]{5,11}#",$ment,$rr);$r=$rr[0];$webtext=file_get_contents('http://www.phperzone.cn/demo/qqinfo-service.php?qq='.$r);preg_match('#"nickname":"(.*?)"#',$webtext,$rr);$rrr=$rr[1];ob_clean();header("Content-type:image/png");$im=imagecreatefromjpeg("1.jpg");$black = ImageColorAllocate($im, 56,73,136);$rrr = mb_convert_encoding($rrr, "utf-8","UTF-8");imagettftext($im,20,0,90,68,$black,"./simsun.ttc",$rrr);imagettftext($im,26,0,87,125,$black,"./simsun.ttc",$r);imagejpeg($im);imagedestroy($im);?>

Obtain the nickname through the QQ number through the requested interface:

<?phpheader("Content-Type:text/html;charset=utf-8");$qq = $_GET ["qq"];echo htmlspecialchars(file_get_contents('http://r.qzone.qq.com/cgi-bin/user/cgi_personal_card'. "?uin=" . $qq));?>

I hope this article will help you with php programming.

Examples: This article describes how to use php to obtain the user name and generate images of the current user in the QQ space. Share it with you...

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.