1. Go to this page and download the library: Download xxx-bin/php-tls-client 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/ */
xxx-bin / php-tls-client example snippets
HPTLSClient\Session;
use PHPTLSClient\Client;
use PHPTLSClient\ClientIdentifier;
// Initialize the TLS client
// The h a specific browser fingerprint
$session = new Session([
'tlsClientIdentifier' => ClientIdentifier::CHROME_124,
'timeoutSeconds' => 30,
]);
try {
// Make a GET request
$response = $session->get('https://httpbin.org/get');
echo "Status: " . $response->status() . "\n";
echo "Body: " . $response->text() . "\n";
} finally {
// Clean up
$session->close();
Client::destroy();
}
use PHPTLSClient\Payload\CustomTlsClient;
use PHPTLSClient\Payload\H2Config;
use PHPTLSClient\Payload\PriorityParam;
// Create H2 configuration from h2fp format
$h2Config = (new H2Config())
->fromH2FP('1:65536;4:131072;5:16384|12517377|3:0:0:201,5:0:0:101,7:0:0:1,9:0:7:1,11:0:3:1,13:0:0:241|m,p,a,s ')
->setHeaderPriority((new PriorityParam())
->setStreamDep(1)
->setExclusive(true)
->setWeight(254));
// Create custom TLS client configuration
$customTlsClient = (new CustomTlsClient())
->setJa3String("771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,10-16-5-11-27-13-0-18-65037-51-65281-17613-45-43-23-35,4588-29-23-24,0")
->setH2Config($h2Config)
->setSupportedSignatureAlgorithms([
CustomTlsClient::SIGNATURE_ALGO_ECDSA_WITH_P256_AND_SHA256,
CustomTlsClient::SIGNATURE_ALGO_PSS_WITH_SHA256,
// ... more algorithms
])
->setSupportedVersions([
CustomTlsClient::TLS_VERSION_GREASE,
CustomTlsClient::TLS_VERSION_1_3,
CustomTlsClient::TLS_VERSION_1_2,
])
->setKeyShareCurves([
CustomTlsClient::KEY_SHARE_CURVE_GREASE,
CustomTlsClient::KEY_SHARE_CURVE_X25519,
// ... more curves
])
->setCertCompressionAlgos([CustomTlsClient::CERT_COMPRESSION_ALGO_BROTLI])
->setAlpnProtocols(["h2", "http/1.1"])
->setAlpsProtocols(["h2"])
->setHeaderOrder(["accept", "user-agent", "accept-encoding", "accept-language"]);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.