<?
$data = "step=one&filled=yes&fresh&iname=Test&fname=TestTest&login=TestTestTest000&done=%C4%E0%EB%FC%F8%E5%A0%26%238594%3B";
$ret = request('POST', 'passport.yandex.ru', '/passport?mode=register', $data, 0);
preg_match('/idkey" value="(.+?)"/', $ret, $d);
$ret = request('GET', 'passport.yandex.ru', '/digits?idkey='.$d[1], 0, 0);
header ('Content-Type: image/gif');
print substr($ret,strpos($ret,"\r\n\r\n")+4);
function request($type, $host, $url, $data, $cook)
{
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />\n";
return 0;
}
else
{
if($type === "GET")
{
$out = "GET $url HTTP/1.0\r\n".
"Host: $host\r\n".
"Cookie: $cook\r\n".
"Connection: close\r\n\r\n";
}
elseif($type === "POST")
{
$out = "POST $url HTTP/1.0\r\n".
"Host: $host\r\n".
"Cookie: $cook\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-Length: ".strlen($data)."\r\n\r\n".$data;
}
fwrite($fp, $out);
$res = '';
while (!feof($fp)) $res .= fgets($fp, 128);
fclose($fp);
return $res;
}
}
?>