<?php
$nick = $_GET["nick"];
if ($nick == "") $nick = "codjng";
$fp = @fsockopen("img.msg.yahoo.com", 80, $errno, $errstr, 5);
if (!$fp) {
header("Content-Type: image/gif");
readfile("avatar.gif");
} else {
$out = "GET /avatar.php?yids=$nick HTTP/1.1\r\n";
$out .= "Host: img.msg.yahoo.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$src = "";
while (!feof($fp)) {
$src .= fgets($fp, 256);
}
if (strpos($src, "‰PNG") === false) {
header("Content-Type: image/gif");
readfile("avatar.gif");
} else {
$src = substr($src, strpos($src, "‰PNG"));
fclose($fp);
if (strlen($src) != 710)
@file_put_contents("avatar/$nick.png", $src);
header("Content-Type: image/png");
echo $src;
}
}
if (!function_exists("file_put_contents")) {
function file_put_contents($filename, $contents) {
$fh = fopen($filename, 'w');
fwrite($fh, $contents);
fclose($fh);
}
}
?>
Title:
Get avatar of Yahoo! Messenger user
Description:
<?php $nick = $_GET["nick"]; if ($nick == "") $nick = "codjng"; $fp = @fsockopen("img.msg....
...
Rating:
4