Faced with a strange phenomenon for me.
There is a php-script, which when launched, pulls out some values from the database, forms a variable and sends its value through a bot to Telegram.
If the script is run manually through the browser, the whole message arrives in Telegram, as it was intended.
If the script is launched by cron, then a message without a variable value arrives in Telegram.
The following is written to cron:
59 23 * * * /usr/bin/php /var/www/myhost.ru/public_html/_tze/cron_script.php Script code:
$message = "Повестка дня:\r\n"; $i=1; $_tasks = mysqli_query($connection, "SELECT `title` FROM `tze_tasks` "); while ($tasks = mysqli_fetch_assoc($_tasks) ) { $message = $message."\r\n".$i.". ".$tasks['title']; $i++; } file_get_contents('https://api.telegram.org/bot276781699:AAFY6PZ7icBbHP1XZS582Pt RzHGhoPezb6U/sendMessage?chat_id='.$chat_id.'&text='.urlencode($message)); What could be the problem?
phpinterpreter, but with a request to the http server via a browser:wget,curl, etc. - aleksandr barakin