PHP code example of semhoun / proxy-detection-middleware

1. Go to this page and download the library: Download semhoun/proxy-detection-middleware 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/ */

    

semhoun / proxy-detection-middleware example snippets


use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
use Slim\Factory\AppFactory;
use Slim\Psr7\Response;

function (Request $request, Response $response, $args) {
    $scheme = $request->getUri()->getScheme();
    $host = $request->getUri()->getHost();
    $port = $request->getUri()->getPort();

    $response->getBody()->write('Real URI is ' . $scheme . '://' . $host . ':' . $port);
    return $response;
});

$app->run();