Created
March 7, 2016 14:03
-
-
Save woodwardtw/a9e4fd0dd01b4e101419 to your computer and use it in GitHub Desktop.
Slack integration to return the current blogs/users on rampages . . . could have done it directly but was playing with regex a bit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$user_agent = "WHATEVER/1.0 (http://bionicteaching.com; bionicteaching@gmail.com)"; | |
$command = $_POST['command']; | |
//$domain = $_POST['text']; | |
$token = $_POST['token']; | |
if($token != 'YOURTOKENHERE'){ | |
$msg = "The token for the slash command doesn't match. Check your script."; | |
die($msg); | |
echo $msg; | |
} | |
$raw = file_get_contents('http://rampages.us'); | |
preg_match('/blogcount\"\>(([0-9]+),([0-9]+))/', $raw, $m); | |
preg_match('/usercount\"\>(([0-9]+),([0-9]+))/', $raw, $f); | |
$blogcount = $m[1]; | |
$usercount = $f[1]; | |
$responsearray = [$blogcount]; | |
$responsearray = [$usercount]; | |
$reply = "Rampages is now at *" . $blogcount . '* blogs and *' . $usercount . '* users. Is that not awesome? Go comment on some of their <http://rampages.us/activity/ | work>.'; | |
echo $reply; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment