Created
January 23, 2018 10:33
-
-
Save shahroznawaz/e3d31cc678eb12a8fbd7541db2a82752 to your computer and use it in GitHub Desktop.
Check and Return The Received Message
This file contains hidden or 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 | |
require __DIR__ . '/vendor/autoload.php'; | |
// Change the following with your app details: | |
// Create your own pusher account @ https://app.pusher.com | |
$options = array( | |
'cluster' => 'ap2', | |
'encrypted' => true | |
); | |
$pusher = new Pusher\Pusher( | |
'42894xxxx1bfbaxxxx65', | |
'60cfxxxxfa4031bxxxxe', | |
'45xxx07', | |
$options | |
); | |
// Check the receive message | |
if(isset($_POST['message']) && !empty($_POST['message'])) { | |
$data = $_POST['message']; | |
// Return the received message | |
if($pusher->trigger('test_channel', 'my_event', $data)) { | |
echo 'success'; | |
} else { | |
echo 'error'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment