avatar creator

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<?php
class Avatar
{
public function getUrl($name, $unique) {
$name = preg_replace("| |", "+", $name);
$url = file_get_contents("http://turnyournameintoaface.com/?name=".mt_rand(0, 99).$name.$unique);
preg_match("|img src=\"(.*)\" alt|", $url, $ava);
$ava = "http://turnyournameintoaface.com/".$ava[1];
return $ava;
}
public function saveAvatar($url) {
// TODO
}
}
$a = new Avatar();
$a->getUrl("CubexX", 1);