array(13) {
["_"]=> string(7) "message"
<b>["out"]=> bool(false)
["mentioned"]=> bool(false)
["media_unread"]=> bool(false)
["silent"]=> bool(false)
["post"]=> bool(true)
["id"]=> int(2620)
["to_id"]=> array(2) {
["_"]=> string(11) "peerChannel"
["channel_id"]=> int(0123456789)
}
["date"]=> int(1528571462)
["message"]=> string(20) "Какой-то текст"
["media"]=> array(2) {
["_"]=> string(17) "messageMediaPhoto"
["photo"]=> array(6) {
["_"]=> string(5) "photo"
["has_stickers"]=> bool(false)
["id"]=> int(5253484880300452176)
["access_hash"]=> int(-7042572160636357761)
["date"]=> int(1528571461)
["sizes"]=> array(4) {
[0]=>
array(6) {
["_"]=> string(9) "photoSize"
["type"]=> string(1) "s"
["location"]= array(5) {
["_"]=> string(12) "fileLocation"
["dc_id"]=> int(2)
["volume_id"]=> int(246227758)
["local_id"]=> int(156735)
["secret"]=> int(-1238137954239302363)
}
["w"]=>
int(51)
["h"]=>
int(90)
["size"]=>
int(1400)
}
[1]=>
array(6) {
["_"]=>
string(9) "photoSize"
["type"]=>
string(1) "m"
["location"]=>
array(5) {
["_"]=>
string(12) "fileLocation"
["dc_id"]=>
int(2)
["volume_id"]=>
int(246227758)
["local_id"]=>
int(156736)
["secret"]=>
int(-4138961335910278788)
}
["w"]=>
int(180)
["h"]=>
int(320)
["size"]=>
int(18298)
}
[2]=>
array(6) {
["_"]=>
string(9) "photoSize"
["type"]=>
string(1) "x"
["location"]=>
array(5) {
["_"]=>
string(12) "fileLocation"
["dc_id"]=>
int(2)
["volume_id"]=>
int(246227758)
["local_id"]=>
int(156737)
["secret"]=>
int(-8459015940988299775)
}
["w"]=>
int(451)
["h"]=>
int(800)
["size"]=>
int(71961)
}
[3]=>
array(6) {
["_"]=>
string(9) "photoSize"
["type"]=>
string(1) "y"
["location"]=>
array(5) {
["_"]=>
string(12) "fileLocation"
["dc_id"]=>
int(2)
["volume_id"]=>
int(246227758)
["local_id"]=>
int(156734)
["secret"]=>
int(7153075355176183764)
}
["w"]=>
int(640)
["h"]=>
int(1136)
["size"]=>
int(101995)
}
}
}
}
["views"]=>
int(1004)
["post_author"]=>
string(18) "Какой-то автор"
}
$dialogs = $MadelineProto->get_dialogs();
$channels = [];
foreach ($dialogs as $a => $b) {
if (isset($b['channel_id'])) {
$channels[] = "-100{$b['channel_id']}";
}
}
$settings = [
"peer" => "",
"offset_id" => "0",
"offset_date" => "0",
"add_offset" => "0",
"limit" => "5",
"max_id" => "0",
"min_id" => "0",
"hash" => "0",
];
$messages = [];
foreach ($channels as $a) {
$settings['peer'] = $a;
$messages[] = $MadelineProto->messages->getHistory($settings);
}
foreach ($messages as $m) {
foreach ($m['messages'] as $n) {
if (isset($n['media']['photo'])) {
$MessageMedia = $n['media']['photo'];
$output_file_name = $MadelineProto->download_to_dir($MessageMedia, 'tmp');
echo $output_file_name;
}
}
}