-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflockhook.php
More file actions
28 lines (25 loc) · 1.12 KB
/
flockhook.php
File metadata and controls
28 lines (25 loc) · 1.12 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
<?php
header('Content-Type: application/json');
$rec_data = file_get_contents('php://input');
$message = json_decode($rec_data, true);
$text = $message['text'];
echo "{\"text\": \"";
if(strpos(strtolower($text), strtolower("#weatherKolkata")) !== false) {
$country="IN";
$url="http://api.openweathermap.org/data/2.5/weather?q=Kolkata,IN&units=metric&cnt=7&lang=en&APPID=fb1d8dcf4118bab4a3a074089555f761";
$json=file_get_contents($url);
$data=json_decode($json,true);
$city = $data['name'];
echo $city."\\n";
echo "Temperature: ".$data['main']['temp']." C\\n";
echo "Condition: ".$data['weather'][0]['main']." \\n";
echo "Condition: ".$data['weather'][0]['description']." \\n";
echo "Humidity: ".$data['main']['humidity']." %\\n";
}
if(strpos(strtolower($text), strtolower("#footfall")) !== false) {
$str = file_get_contents('http://checkin.dpsnmunc.in/footfall/json.php');
$json = json_decode($str, true);
echo "Footfall: ".$json['total']."\\nSchool Delegation: ".$json['schooldel']."\\nIndividual Applicants: ".$json['indidel']."\\nDPS Newtown Delegates: ".$json['dpsndel'];
}
echo "\"}";
?>