The hltv based module for the automatic event grabbing
-
What is it? This is PHP code for parsing Hltv requests.
-
What can it do? It can get actual match-list, get detailed match-info for single match.
-
What I need to work with it? First of all you need web-server with PHP 7.0+ ( PDO and cURL should be enabled). Then look at install section.
-
Install via Composer:
{ "require": { "webrepin/hltv-api": "*" } }
-
Initialize Hltv-Api like this:
require_once 'vendor/autoload.php'; use HltvApi\Client; $client = new Client();
-
Supported list of requests is:
Type URL Supported ongoing https://www.hltv.org/matches upcoming https://www.hltv.org/matches results https://www.hltv.org/results matchDetails https://www.hltv.org/matches/xxxx-xxxx-xxxxx -
All request return object abstract layer based on Entity
use HltvApi\Entity\Entity;
Example how to getting ongoing match list:
require_once 'vendor/autoload.php'; use HltvApi\Client; $client = new Client(); $matches = $client->ongoing(); foreach ($matches as $match) { echo $match->getTeam1(); echo $match->getTeam2(); echo $match->getMatchUrl(); echo $match->getMatchUrl(); }
Follow the match details:
echo $match->details()->getOdds() echo $match->details()->getMapName(1) echo $match->details()->getMapScore(1) echo $match->details()->getMapResults(1)
-
To getting more stability you can protect your request by using Proxy list
require_once 'vendor/autoload.php'; use HltvApi\Client; $client = new Client([ ['0.0.0.0', '80', CURLPROXY_SOCKS5], ['0.0.0.0', '443', CURLPROXY_HTTP], ... ]);