class EventScraper (View source)

The EventScraper class is responsible for scraping event details from a given URL and returning an EventDTO.

It uses an HTTP client to fetch the HTML content and a parser to extract the relevant information.

Example usage: $httpClient = new DefaultHttpClient(); $parser = new ParseEvent(); $scraper = new EventScraper($httpClient, $parser); $eventDTO = $scraper->scrape('https://www.blackcombat.com/event/123'); // $eventDTO will contain the scraped event details

Methods

__construct(HttpClientInterface $http, ParseEvent $parser)

EventScraper constructor.

scrape(string $url)

Scrape event details from the given URL and return an EventDTO.

Details

__construct(HttpClientInterface $http, ParseEvent $parser)

EventScraper constructor.

Parameters

HttpClientInterface $http

An HTTP client for fetching HTML content.

ParseEvent $parser

A parser for extracting event details from HTML.

EventDTO scrape(string $url)

Scrape event details from the given URL and return an EventDTO.

Parameters

string $url

The URL of the event page to scrape.

Return Value

EventDTO

The scraped event details as an EventDTO.