Сделал скрипт читает и сохраняет текст, терь появилась нужда чтоб он ещё и картинки сохранял с мелодиями, как это реализовать как скачать картинку с сервера?
PHP: <?php imagejpeg(imagecreatefromstring(base64_decode( "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEP ERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4e Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCACwAIQDASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3 uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD5iDUb hVffS760uWWN1LuFV99G+ncCyGpdwqtvpd9FwLG4Uu4VW30u+i4FneKN4qjdXcdvHvkb6AdTWNc6 pdSkhG8pfRev50nIGzqN9G+uQS8u0bIuJc+7E1qadq3mMIrjCseAw6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4k1i0e+mHzuW6D+6PQVkzeFPg1O++Xxjort3LavCf/AGarFp4a+CsBB/4S jw+/11WD/wCKrDETpVYctpfcRKcn6HqNhqGn3wzaXcM3+42auiOuK0PUvhbowAsPFXhyPH/UVh/+ KrcHjrwL/wBDp4b/APBpD/8AFV4FXDzv7kXb0DQ2vLorG/4TrwL/ANDp4b/8GkP/AMVRWHsK38j+ 5hofBNFFFfrpwhRRRQAUUUUAFdr4A0RL51dwCWNcVXWeCde/s6RUdgMHigD03xB4Nih0wSFF5Ga8 X8QWYs9QeNcYPSvV9d8bLNpwjMwOBjrXkutXhvb5pc8dqAKNFFFABRRRQAUUUUAFFFFAH//Z" ))); ?>
Код (Text): Content-Type: image/jpeg; Эта строка о чем-нибудь говорит? И не цитируй такие куски - устал прокручивать.
Говорит но как сохранить файлом, нужно все вложения сохранять в файлы Я делаю так PHP: $fp=fopen("$filename","w+"); $fd=fputs($fp,$bodyattach[1]); fclose($fp); $bodyattach[1] содержит то что я люблю цитировать но без PHP: Content-Type: image/jpeg; name="skinmenuidleimage.jpg" Content-Disposition: attachment; filename="skinmenuidleimage.jpg" Content-Transfer-Encoding: base64 В итоге фаил не открывается Символ перевода каретки нужно оставлять или удалять?
Есть вменяемые? а то ни на одном форуме ни кто не может ни че толкового сказать, только умничают Мне нужно просто все вложения из почты сохранить в папку на сервере
PHP: <?php class POPmbox { const READ_BYTES_LEN = 128; private $tcp_socket; public function __construct($host, $port) { // Открываем сокет. $this->tcp_socket = fsockopen( $host, $port, $errno, $errstr, 5 ); } public function __destruct() { // Закрываем сокет. fclose($this->tcp_socket); } public function send_command($cmd) { // Отправляем команду. fputs($this->tcp_socket, $cmd."\n"); } public function command_result($answer) { return ($answer{0} == '+') ? true : false; } public function get_response() { // Возвращаем однострочный ответ. return fgets($this->tcp_socket, self::READ_BYTES_LEN); } public function get_response_multiline() { // Возвращаем многострочный ответ. $response = ''; do { $output = fgets($this->tcp_socket, self::READ_BYTES_LEN); $response .= $output; } while($output[0] != '.'); return $response; } } ?> PHP: <?php class MMS extends POPmbox { const SAVE_PATH = 'images/'; public function __construct($host, $port) { parent::__construct($host, $port); } public function get_boundary($message) { $headers = substr($message, 0, strpos($message, "\r\n\r\n")); $boundary_regexp = '/boundary=\"(.*)\"/i'; preg_match_all($boundary_regexp, $headers, $out, PREG_PATTERN_ORDER); $boundary = $out[1][0]; if($boundary) { return $boundary; } return false; } public function save_part($entry) { global $_MYSQLI, $_CFG; if(preg_match('/Content-type: image\/(.*)/i', $entry)) { $md5 = md5(microtime()); $filename = $md5.'.jpg'; $filename_tn = $md5.'_tn.jpg'; // Не факт, что письмо будет в кодировке base64. $img_str = base64_decode(str_replace("\r\n", '', (substr($entry, strpos($entry, "\r\n\r\n"), strlen($entry))))); $im = imagecreatefromstring($img_str); imagejpeg($im, self::SAVE_PATH.$filename); // Делаем тамбнейл resample(self::SAVE_PATH.$filename, self::SAVE_PATH.$filename_tn, null, $_CFG['tn_width'], null); $_MYSQLI->real_query( "INSERT `{$_CFG['table_prefix']}mms` SET `filename` = '$md5'" ); } } public function cmd_list_result() { $messages = array(); // Считываем +OK $this->get_response(); // Читаем все остальное $result = $this->get_response_multiline(); $result = explode("\n", $result); // Парсим ответ в массив. foreach($result as $result_line) { if($result_line{0} == '.') { break; } $messages[] = explode(" ", $result_line); } return $messages; } } ?>