PHP code example of pjdietz / shamserver
1. Go to this page and download the library: Download pjdietz/shamserver library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pjdietz / shamserver example snippets
use pjdietz\ShamServer\ShamServer;
$host = "localhost";
$port = 8080;
$router = "/path/to/my/router.php";
// Start up a testing web server.
$server = new ShamServer($host, $port, $router);
// A server is now listening at http://localhost:8080
// Shut down the web server.
$server->stop();
// Create a server that always responds with a 401 status code.
$host = "localhost";
$port = 8080;
$router = " http_response_code(401);";
$server = new StringShamServer($host, $port, $router);