Home > Backend Development > PHP Tutorial > PHP implements QQ space to obtain the username of the current user and generate pictures, _PHP tutorial

PHP implements QQ space to obtain the username of the current user and generate pictures, _PHP tutorial

WBOY
Release: 2016-07-13 09:45:57
Original
1134 people have browsed it

php implements QQ space to obtain the username of the current user and generate pictures.

This article describes the example of php implementing QQ space to obtain the username of the current user and generate pictures. Share it with everyone for your reference. The details are as follows:

Recently, I found that some pictures containing the current user’s nickname and QQ number are often reprinted in the space. I was very curious and studied the principle
The principle is very simple, the picture is generated using php, okay, just enter the code

Image source code:

<&#63;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&#63;qq='.$r);
preg_match('#"nickname":"(.*&#63;)"#',$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);
&#63;>

Copy after login

The requested interface obtains the nickname through the QQ number:

<&#63;php
header("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'. "&#63;uin=" . $qq));
&#63;>

Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1038587.htmlTechArticlephp implements QQ space to obtain the user name of the current user and generates pictures. This article describes the example of php implementing QQ space to obtain the current user name. The user's username and a method to generate a picture. Share it with everyone...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template