-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgoogle.php
More file actions
31 lines (21 loc) · 708 Bytes
/
google.php
File metadata and controls
31 lines (21 loc) · 708 Bytes
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
<?php
// replace with your url you got here : https://my.slack.com/services/new/incoming-webhook
$INCOMING_WEBHOOK_URL = "";
$USERNAME = "Y U NO GOOGLE GOD DAMNIT?";
$ICON = ":troll:";
$text = $_POST['text'];
$channel_name = $_POST['channel_name'];
$curl = curl_init($INCOMING_WEBHOOK_URL);
curl_setopt($curl, CURLOPT_POST, true);
$response = "https://www.google.com/?#q=".rawurlencode($text);
$payload = array(
'text' => rawurlencode($response),
'username' => $USERNAME,
'icon_emoji' => $ICON,
'channel' => "#".$channel_name
);
$jsonPayload = "payload=".json_encode($payload);
curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonPayload);
$return = curl_exec($curl);
curl_close($curl);
?>