I want to get the message of a telegram channel, and I found madeline proto for that.
But, unfortunately, I did not work with php so I want to implement this function with POST API in php to get By POST API in java.
My question is how? and anyone could give me a reference or code.
<?php
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';
$MadelineProto = new danogMadelineProtoAPI('session.madeline');
$MadelineProto->start();
// Execute for an unlimited time span
set_time_limit(0);
$channel = '@achannel';
while (true) {
$messages_Messages = $MadelineProto->messages->getHistory(
['peer' => $channel,
'offset_id' => 0,
'offset_date' => 0,
'add_offset' => 0,
'limit' => 0,
'max_id' => 0,
'min_id' => 0,
'hash' => 0 ]);
$i = 0;
foreach ($messages_Messages['messages'] as $message) {
$m = " id: " . $message['id'] . " message: " . @$message['message'] . "%n%";
#$data = array_push($data, $m);
#echo $m;
$i++;
if($i < 5){
break;
}
}
}
2
Answers
Use
PHP CURL
:Here is an example of
PHP curl
You can post like this with curl,