PHP code example of olipayne / guzzle-web-bot-auth-middleware
1. Go to this page and download the library: Download olipayne/guzzle-web-bot-auth-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/ */
olipayne / guzzle-web-bot-auth-middleware example snippets
$middleware = new WebBotAuthMiddleware(
$privateKey,
$keyId,
'https://agent.example/.well-known/http-message-signatures-directory',
'web-bot-auth',
300,
'sig',
'cloudflare_legacy'
);
uzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use Olipayne\GuzzleWebBotAuth\WebBotAuthMiddleware;
$stack = HandlerStack::create();
$stack->push(new WebBotAuthMiddleware(
'/run/secrets/ed25519_private.key',
'YOUR_UNPADDED_BASE64URL_JWK_THUMBPRINT',
'https://agent.example'
));
$client = new Client(['handler' => $stack]);
$response = $client->get('https://origin.example/api/data');
$middleware = new WebBotAuthMiddleware(
$privateKey,
$keyId,
'https://agent.example/keys.json',
'web-bot-auth',
300,
'sig',
'jwks_uri'
);
bash
php vendor/olipayne/guzzle-web-bot-auth-middleware/bin/generate-keys.php
bash
php vendor/olipayne/guzzle-web-bot-auth-middleware/bin/generate-jwk.php path/to/ed25519_public.key