symfony-httpvscurl-impersonate
Symfony-http is a PHP library that provides a set of classes for working with HTTP requests and responses. It is part of the Symfony CMS framework, but can also be used independently.
Curl-impersonate is a special build of libcurl
and cURL HTTP client that impersonates the four major browsers:
- Google Chrome
- Microsoft Edge
- Safari
- Firefox
Curl-impersonate achieves this by patching TLS and HTTP fingerprints to be identical to that of one of these real browsers.
Unlike other HTTP clients curl-impersonate can bypass TSL and HTTP fingerprinting and detection techniques though it does not implement anything for Javascript fingerprint or bypass.
Highlights
bypasshttp2tls-fingerprinthttp-fingerprintlow-level
Example Use
<?php
use Symfony\Component\HttpClient\HttpClient;
// create a client object:
$client = HttpClient::create();
// sent GET request
$response = $client->request('GET', 'https://httpbin.org/get');
// or POST request
$response = $client->request('POST', 'https://httpbin.org/post', [
'headers' => [
'Content-Type' => 'application/json',
],
'json' => [
'name' => 'John Doe',
'email' => 'john.doe@example.com',
],
]);
// print response data:
$statusCode = $response->getStatusCode();
$content = $response->getContent();
echo "Status Code: $statusCode\n";
echo "Content: $content\n";
curl-impersonate installs itself under `curl_` terminal commands like `curl_chrome116`:
To use it in HTTP client libraries that use `libcurl` replace curl path with one of these.
To use it in python directly see curl-cffi Python package
$ curl_chrome116 https://www.wikipedia.org