1. Go to this page and download the library: Download fperdomo/http 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/ */
fperdomo / http example snippets
use Http\HttpRequest;
$request = new HttpRequest($_GET, $_POST, $_COOKIE, $_FILES, $_SERVER, file_get_contents('php://input'));
use Http\HttpRequest;
use Http\HttpResponse;
use Http\CookieBuilder;
$loader = an example
$cookieBuilder->setDefaultSecure(false);
$request = new HttpRequest($_GET, $_POST, $_COOKIE, $_FILES, $_SERVER, file_get_contents('php://input'));
$response = new HttpResponse;
$content = '<h1>Hello World</h1>';
$content .= $request->getCookie('TestCookie', 'Cookie is not set.');
if ($request->getParameter('setCookie') === 'true') {
$cookie = $cookieBuilder->build('TestCookie', 'Cookie is set.');
$response->addCookie($cookie);
}
$response->setContent($content);
foreach ($response->getHeaders() as $header) {
header($header);
}
echo $response->getContent();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.