|DRC| Wartex
|
Sunday, August 7 2011, 17:15:09 #43681
<?php
$imgname = "wartex.jpg";
$im = @imagecreatefromjpeg($imgname);
header('Content-Type: image/jpeg');
function download_file($file, $ref)
{
$curl_obj = curl_init();
curl_setopt($curl_obj, CURLOPT_URL, $file);
curl_setopt($curl_obj, CURLOPT_REFERER, $ref);
curl_setopt($curl_obj, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($curl_obj, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl_obj, CURLOPT_MAXREDIRS, SPDR_MAX_REDIR);
curl_setopt($curl_obj, CURLOPT_SSL_VERIFYPEER, FALSE);
$downloaded_binary = curl_exec($curl_obj);
curl_close($curl_obj);
return $downloaded_binary;
}
$file = 'http://www.quakelive.com/profile/statistics/Wartex?_=444';
$cut_start = '<div class="prf_weapons cl">';
$cut_end = '<div id="qlv_profileMiddle" class="statistics">';
$html = download_file($file, 'http://www.quakelive.com');
$rest = substr($html, strpos ( $html, $cut_start) + strlen($cut_start));
$rest = substr($rest, 0, strpos ( $rest, $cut_end));
$rest = preg_replace('/\ \ +/', ' ', $rest);
preg_match_all("#<p ([^>]*)>(.+?)</p>#is", $rest, $matches);
$divs = $matches[2];
unset($matches);
$acc_values = Array();
foreach ($divs as $key => $value)
{
preg_match_all("#<div ([^>]*)>(.+?)</div>#is", $value, $matches);
$matches[2][2] = strip_tags($matches[2][2]);
$acc_values[$matches[2][0]] = $matches[2];
}
//print_r($acc_values);
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
$text = 'QUAKELIVE ACCURACIES';
$font = 'SF_Quartzite.ttf';
$fsize = 20;
imagettftext($im, $fsize, 0, 13, 28, $black, $font, $text);
imagettftext($im, $fsize, 0, 12, 27, $white, $font, $text);
$fsize = 12;
$text = 'Railgun: '.$acc_values['Railgun'][2];
imagettftext($im, $fsize, 0, 13, 48, $black, $font, $text);
imagettftext($im, $fsize, 0, 12, 47, $white, $font, $text);
$text = 'Rocket Launcher: '.$acc_values['Rocket Launcher'][2];
imagettftext($im, $fsize, 0, 13, 58, $black, $font, $text);
imagettftext($im, $fsize, 0, 12, 57, $white, $font, $text);
$text = 'Lightning Gun: '.$acc_values['Lightning Gun'][2];
imagettftext($im, $fsize, 0, 13, 68, $black, $font, $text);
imagettftext($im, $fsize, 0, 12, 67, $white, $font, $text);
imagejpeg($im);
imagedestroy($im);
?> |
|