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

WBOY
Release: 2016-07-25 08:44:34
Original
1069 people have browsed it

The example in this article describes the method of using PHP to obtain the username of the current user and generate pictures in QQ space. 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:

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

The requested interface is to obtain the nickname through the qq number:

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

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

php


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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!