TURFのポイントランキングを画像で出力
下のコードを使って。
出力例:
<?php $id = "your@mail.address"; $pwd = "your_password"; /********** 中略 **********/ // print $rq->getResponseBody(); ここで出力しません $body = $rq->getResponseBody(); preg_match("/<a href=\"\/point\/myrank.asp\">(\d+)pt\(<font color=\"#FF0000\">(\d+)</i", $body, $matches); $point = $matches[1]; $rank = $matches[2]; $str1 = "*TURF Rank*"; $str2 = "$rank (".$point."pt)"; $img = imagecreate(100, 30); imagecolorallocate($img, 255, 255, 255); $color1 = imagecolorallocate($img, 255, 0, 0); $color2 = imagecolorallocate($img, 0, 0, 255); imagestring($img, 3, 1, 1, $str1, $color1); imagestring($img, 3, 1, 15, $str2, $color2); header("Content-type: image/png"); imagepng($img); imagedestroy($img); /********** 以下略 **********/