-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.php
More file actions
45 lines (32 loc) · 1.2 KB
/
main.php
File metadata and controls
45 lines (32 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
$token = '2105277243:AAEstwP_0UNazeLM1AXZf3gE22eRxnZEC-4';
$link = 'https://api.telegram.org:443/bot'.$token.'';
$getupdate = file_get_contents('php://input'); // for webhook
$responsearray = json_decode($getupdate, TRUE);
$chatid = $responsearray['message']['chat']['id'];
if ($responsearray['message']['text']=="/start") {
$message = "welcome to @wallstreetanalysisbot \ntext /fetch for prediction";
}
elseif ($responsearray['message']['text']=="/fetch"){
$message = file_get_contents("https://wsasentiapi.herokuapp.com/fetch");
$message = str_replace("<p>","",$message);
$messgae = str_replace("Bullish<p>","Bullish",$message);
$message = str_replace("Bearish</p>","Bearish",$message);
$message = str_replace("</p>","",$message);
}
else {
$message="Invalid command";
}
$parameter = array(
'chat_id' => $chatid,
'text' => $message,
);
$request_url = $link.'/sendMessage?'.http_build_query($parameter);
file_get_contents($request_url);
$parameter = array(
'chat_id' => $chatid,
'text' => "Analyse best stocks to invest into at just $69 for 6 months \nKnow more: https://bit.ly/3cjENwF",
);
$request_url = $link.'/sendMessage?'.http_build_query($parameter);
file_get_contents($request_url);
?>