PHP implementation of the QQ space to get the user name of the current user and generate pictures,
In this paper, we describe the method that PHP realizes the user name of the current user and generates a picture in QQ space. Share to everyone for your reference. Specific as follows:
Recently found in the space is often reproduced some contain the current user nickname and QQ number of pictures, very curious, studied the principle
The principle is simple, the image is generated using PHP, OK, directly on the code
Image source code:
<?php$ment = $_server["Http_referer"];if ($ment = = ' http://cnc.qzs.qq.com/qzone/newblog/v5/editor.html ') { Header ("http/1.0 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);p reg_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);? >
The requested interface gets the nickname via the QQ number:
<?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 is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1038587.html www.bkjia.com true http://www.bkjia.com/PHPjc/1038587.html techarticle PHP Implementation of the QQ space to obtain the current user's user name and generate pictures, this article describes the PHP implementation of the QQ space to obtain the current user's user name and create a picture method. Share for the big ...