Created
January 8, 2019 00:42
-
-
Save ProdigyView/ee3c96b97277cbfe848b0d38328ef851 to your computer and use it in GitHub Desktop.
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 | |
include_once (dirname(__FILE__) . '/../vendor/autoload.php'); | |
use prodigyview\system\Security; | |
use prodigyview\network\Socket; | |
//Create The Server | |
$server = new Socket('localhost', 8650, array( | |
'bind' => true, | |
'listen' => true | |
)); | |
//Start The Server | |
$server->startServer('', function($message) { | |
//Decrypt our encrypted message | |
Security::init(); | |
$message = Security::decrypt($message); | |
//Turn the data into an array | |
$data = json_decode($message, true); | |
//Default response | |
$response = array('status' => 'success', 'message' => 'Responding'); | |
//JSON encode the response | |
$response =json_encode($response); | |
//Return an encrypted message | |
return Security::encrypt($response); | |
}, 'closure'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment