1. Go to this page and download the library: Download browser7/sdk 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/ */
$client = new Browser7Client('b7_your_api_key_here');
$result = $client->render('https://example.com', [
'countryCode' => 'US'
]);
echo $result->html; // Rendered HTML
print_r($result->selectedCity); // City used for rendering
use Browser7\WaitAction;
$result = $client->render('https://example.com', [
'countryCode' => 'GB',
'city' => 'london',
'waitFor' => [
WaitAction::click('.cookie-accept'), // Click element
WaitAction::selector('.main-content'), // Wait for element
WaitAction::delay(2000) // Wait 2 seconds
]
]);
// Production (default)
$client = new Browser7Client('your-api-key');
// Canadian endpoint
$client = new Browser7Client(
'your-api-key',
'https://ca-api.browser7.com/v1'
);