<?php $hostname = "imgl.yandex.net"; $path = "/i/www/logo.png"; $otvet = ""; $fp = fsockopen($hostname, 80, $errno, $errstr, 30); $data = "\r\n\r\n"; $headers = "POST $path HTTP/1.1\r\n"; $headers .= "Host: $hostname\r\n"; $headers .= "Content-type: application/x-www-form-urlencoded\r\n"; $headers .= "Content-Length: ".strlen($data)."\r\n\r\n"; fwrite($fp, $headers.$data); while (!feof($fp)) { $otvet .= fgets($fp, 1024); } fclose($fp); $massiv_otveta=explode("\n",$otvet); $nachalo_ishodnica = array_search('', $massiv_otveta)-3; $konec_ishodnica = count($massiv_otveta); $filename = 'negri.png'; $handle = fopen($filename, 'x'); for ($i=$nachalo_ishodnica;$i<=$konec_ishodnica;$i++) { fwrite($handle, $massiv_otveta[$i]); } fclose($handle); ?>