Skip to content

Instantly share code, notes, and snippets.

@k1LoW

k1LoW/1.URL.md Secret

Last active October 19, 2016 15:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save k1LoW/c9f6931c26fecb6827172f66604513e4 to your computer and use it in GitHub Desktop.
Fukuoka.php Vol.19 Hands on
<?php
$endpoint = 'https://hooks.slack.com/services/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';
$rawBody = file_get_contents(getenv('req'));
$data = json_decode($rawBody);
if ($data->message) {
$message = [
"channel" => "#random",
"username" => "[Your ID]",
"text" => $data->message
];
$options = [
'http' => [
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => json_encode($message),
]
];
$response = file_get_contents($endpoint, false, stream_context_create($options));
}
file_put_contents(getenv('res'), 'Azure Love PHP??');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment