Skip to content

Instantly share code, notes, and snippets.

@shahroznawaz
Created January 23, 2018 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shahroznawaz/e3d31cc678eb12a8fbd7541db2a82752 to your computer and use it in GitHub Desktop.
Save shahroznawaz/e3d31cc678eb12a8fbd7541db2a82752 to your computer and use it in GitHub Desktop.
Check and Return The Received Message
<?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