Hi i have script that i want to run on my localhost . the code in PHP , and when i run my localhost, it says
Parse error: syntax error, unexpected '>' in /Applications/XAMPP/xamppfiles/htdocs/bot/course.php on line 23
this is the code:
<?php
ob_start();
$API_KEY = '';
define('API_KEY',$API_KEY);
function bot($method,$datas=[]){
$url = "https://api.telegram.org/bot".API_KEY."/".$method;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$datas);
$res = curl_exec($ch);
if(curl_error($ch)){
var_dump(curl_error($ch));
}else{
return json_decode($res);
}
}
$update = json_decode(file_get_contents('php://input'));
$message = $update- >message;
$text = $message- >text;
$chat_id = $message- >chat- >id;
if ($text =='/start') {
bot('sendMessage',[
'chat_id' => $chat_id,
'text'=> 'Welcome',
]);
}
Line 23 is $message, I really dont see any wrongs there ?