<?phpheader("Content-type: image/png");*/ Function to check Alexa rank */ function get_alexa($url){$site = fopen('http://www.alexa.com/data/details/main?url='.urlencode($url),'r');while($cont = fread($site,1024657)){$total .= $cont;}fclose($site);$match_expression = '/for more information about the Alexa Web Information Service.-->(.*)<\/span><\/a>/Us';preg_match($match_expression,$total,$matches);return strip_tags($matches[1]);}*/ Website URL */$urlh = getenv(HTTP_HOST);$link = "http://$urlh";/*Create an image from a PNG template*/ $string = get_alexa($link);$im = imagecreatefrompng("button.png");$color = imagecolorallocate($im, 000, 000, 100);$px = (imagesx($im) - 7.5 * strlen($string)) / 2;imagestring($im, 3, $px, 10, $string, $color);imagepng($im);imagedestroy($im);?>
<?phpheader("Content-type: image/png");//Function to check Alexa rankfunction get_alexa($url){$site = fopen('http://www.alexa.com/data/details/main?url='.urlencode($url),'r');while($cont = fread($site,1024657)){$total .= $cont;}fclose($site);$match_expression = '/for more information about the Alexa Web Information Service.-->(.*)<\/span><\/a>/Us';preg_match($match_expression,$total,$matches);return strip_tags($matches[1]);}//Website URL$urlh = getenv(HTTP_HOST);$link = "http://$urlh";//Create an image from a PNG template $string = get_alexa($link);$text = '-Alexa-';$stringa = $string . $text . $urlh;$im = imagecreatefrompng("button.png");$color = imagecolorallocate($im, 0, 0, 0);imagestring($im, 3, 5, 11, $stringa, $color);imagepng($im);imagedestroy($im);?>