PHP code example of kelvinzer0 / curl-impersonate-php
1. Go to this page and download the library: Download kelvinzer0/curl-impersonate-php 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/ */
kelvinzer0 / curl-impersonate-php example snippets
CurlImpersonate\CurlImpersonate;
$curl = new CurlImpersonate();
// Option 1: Use a browser preset (auto-detects binary path)
$response = $curl
->setBrowser(CurlImpersonate::BROWSER_CHROME)
->setopt(CurlImpersonate::OPT_URL, 'https://example.com')
->setopt(CurlImpersonate::OPT_METHOD, 'GET')
->exec();
echo $response;
// Option 2: Point to a specific binary
$curl = new CurlImpersonate();
$response = $curl
->setopt(CurlImpersonate::OPT_URL, 'https://example.com')
->setopt(CurlImpersonate::OPT_ENGINE, '/path/to/curl_chrome116')
->exec();