PHP code example of pbxg33k / flaresolverr-bundle
1. Go to this page and download the library: Download pbxg33k/flaresolverr-bundle 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/ */
pbxg33k / flaresolverr-bundle example snippets
// config/bundles.php
return [
// ...
Pbxg33k\FlareSolverrBundle\FlareSolverrBundle::class => ['all' => true],
];
// src/Controller/ExampleController.php
namespace App\Controller;
use Pbxg33k\FlareSolverrBundle\Client\FlareSolverrClient;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
class ExampleController extends AbstractController
{
public function __construct(
private(set) FlareSolverrClient $flareSolverrClient
)
{
}
public function index(): Response
{
$response = $this->flareSolverrClient->requestGet('https://example.com');
$HTMLContentAsString = $response->getResponseContent();
$HTMLDocumentAsDOMDocument = $response->getResponseContentAsHTMLDocument();
// Do your magic with the response here
}
}