Ловите
Код
<?php
$xvala = array("безупречный! =)", "крутой! =)", "идеальный! =)", "умный! =)", "замечательный! =)", "мужественный! =)", "стильный! =)", "смелый! =)", "продвинутый! =)",
"великодушный! =)", "мудрый! =)", "отзывчивый! =)", "сообразительный!");
$tz = $_SERVER["HTTP_REFERER"];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $tz);
curl_setopt($ch, CURLOPT_USERAGENT,'Chrome 11');
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); //Из какого файла читать
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); //В какой файл записывать
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
preg_match("/читает'>(?:<b.{27}'>([^<]*)|([^<]*))/", $result, $out, PREG_OFFSET_CAPTURE);
if(strpos($tz, "c-s.net.ua")!==false) header("Content-type: image/png");
else {echo "Простите! Изображение удалено!"; exit();}
if(count($out[0][1])!=0) {
if($out[1][1]>-1 && $out[2][1]>-1) {
if($out[1][1]>$out[2][1]) $t123=2; else $t123=1;}
else
if($out[1][1]==-1) $t123 = 2; else $t123 = 1;
}
function iso2uni ($isoline) {
for ($i=0; $i < strlen($isoline); $i++){
$thischar=substr($isoline,$i,1);
$charcode=ord($thischar);
$uniline.=($charcode>175)?"&#".(1040+($charcode-176)).";":$thischar;
}
return $uniline;
}
$im = imagecreate(300, 17);
$bg = imagecolorallocate($im, 238, 238, 238);
$textcolor = imagecolorallocate($im, 0, 0, 0);
$black = imagecolorallocate($im, 0, 0, 0);
$font = 'times.ttf';
if($t123 <>0 ) ImageTTFText ( $im, 13, 0, 0, 13, $black, $font, iso2uni( convert_cyr_string( $out[$t123][0] . " - " . $xvala[rand(0, count($xvala)-1)] ,"w","i") ));
else ImageTTFText ( $im, 13, 0, 0, 13, $black, $font, iso2uni( convert_cyr_string( "хвалить некого, печалька =(" ,"w","i") ));
imagepng($im);
imagedestroy($im);
?>