QQ空间获取当前用户名最近很流行在qq空间里转载带有当前用户的一些图片,简单研究一下其实就是利用php来创建的一个简单的图片。
1 }6 v/ @* j7 h, m: n生成图片 image.php:' h' I3 s3 M2 \2 w9 I
[PHP] 纯文本查看 复制代码 <!--?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/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);
?-->
" ]* i# Q; A* G, ^' I+ n. J2 }# ?( f$ w _: q S; L. H. N
9 ^' Z# v+ k6 R- o3 u
接口文件 qqinfo-service.php:; R- w7 f# R/ p& @2 a3 J8 f$ J
[PHP] 纯文本查看 复制代码 <!--?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'. "?uin=" . $qq));
?--> ; I. W8 s& v# N( j6 V0 ?
; l" l% b* Y# x
3 M. B2 h; F( [7 N% r8 E+ M9 Y7 [) S
源码下载 上传PHP空间
- m5 o0 ^* g6 G7 E* }- @2 z- d. R& |' U( n, T2 `0 b# y
: K1 ?2 v% X+ V' G
! s; }: [# j3 o
|