PHP 7 Cricbuzz API Example Script to Fetch Live Cricket Score of Matches in Browser Using HTML5 & Javascript Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments



Free Cricket API 🍔

Live Cricket Score API 🏏

unofficial API Data Fetched from

This is an unofficial API and not Linked or Partnered with Any Brands/Company.

How it Works? 🤔

We are just fetching the data from Cricbuzz using PHP cURL preg_match and preg_math_all. It’s kind of scraping but we are not storing any data or link in our end.

Everything is scraped live and shown to end users in realtime.

API URL 🌐<Live Match URL>

Requirements 📑

  • Server with PHP Support
  • PHP 7.2 or 7.3 or 7.4
  • PHP cURL
  • Nginx, Apache2 or Lightspeed
  • HTTPS (For Secure SSL Connections)

Installation 🍯

  • Download or Clone Repo to your Server
git clone
cd cricket-api
cd cri
  • Test the API
php -S localhost:6001

Usage 🍟

  • Get the Live Match Score URL from –
  • Enter them Directly or replace www with m

Example 📋




Example Response 🌐

Cricket API

    "success": true,
    "livescore": {
        "title": "Sunrisers Hyderabad vs Mumbai Indians, 56th Match",
        "current": "SRH - 145\/0 (16.2)",
        "batsman": "Wriddhiman Saha*",
        "batsmanrun": "57",
        "ballsfaced": "(43)",
        "fours": "7",
        "sixes": "1",
        "bowler": "Nathan Coulter-Nile*",
        "bowlerover": "3.2",
        "bowlerruns": "25",
        "bowlerwickets": "",
        "partnership": "145(98)",
        "recentballs": "Data Not Found",
        "lastwicket": "... 0 0 4 1 | 0 4 1 1 0 1 | 1 0",
        "runrate": "CRR: 8.88",
        "commentary": [
            "16.2 Coulter-Nile to W Saha, no run, 139.1kph, ",
            "16.1 Coulter-Nile to Warner, 1 run, 124.4kph, length, nipping in off the pitch onto middle. Warner makes room and slaps it to deep point ",
            "15.5 Pattinson to Warner, no run, 139.7kph, backs away, cuts, but ends up miscuing it back down the pitch ",
            "15.4 Pattinson to W Saha, 1 run, swivels, one-legged, pulling it to the man in the deep behind square ",
            "15.3 Pattinson to Warner, 1 run, 118.2kph, back of a length, taking pace off, keeping it outside off for Warner to have to reach out. And he does connect this time, to guide it to third man ",
            "15.1 Pattinson to Warner, no run, 134.5kph, full, outside off, quick, just inside the tramline. Warner stretches, but can't quite connect ",
            "14.6 Coulter-Nile to Warner, 1 run, 130.6kph, length, nips back in, and Warner jumps away at the last moment with an opened bat face to steer it through point ",
            "14.4 Coulter-Nile to Warner, no run, skids through as it seams back in sharply to go under Warner's crouched swat, thudding off his thighs towards backward point ",
            "14.3 Coulter-Nile to Warner, no run, 136.4kph, serious bouncer, climbing back in. Nope, it's the circumstances that determines its ferocity, and with an 18 runs | 33 balls equation, this is gently left alone ",
            "14.2 Coulter-Nile to W Saha, 1 run, 136.9kph, full, on middle with the angle-in. Saha goes wristy, through mid-wicket ",
            "14.1 Coulter-Nile to W Saha, no run, 117kph, in-cutter into the tummy. Saha gets cramped in what looked like an initial attempt to cut, and so drops his wrists, opens his bat face and runs out to short third man ",
            "13.6 D Kulkarni to Warner, 2 runs, 105.4kph, and very comfortable. Around the fourth-stump, which Warner lines up to and punches through point ",
            "13.5 D Kulkarni to W Saha, 1 run, 127.6kph, full, on off, quiet flick, long-on "
        "teamone": "Data Not Found",
        "teamtwo": "Data Not Found",
        "update": "Sunrisers Hyderabad need 5 runs in 22 balls"

Code Examples ☕

  • WordPress
## API Auth and Get data
function display_api_response() {
  $base_url = '';
  $score_path = '';
  $url = $base_url.$score_path;
  $response = wp_remote_get($url);
  global $body;
  $body = json_decode( $response['body'], true );
add_action( 'init', 'display_api_response' );

Replace YOUR-API-Domain with your actual API Domain

  • Fetch API (Javascript)
var url = '';

async function fetchscore() {
    try {
        const response = await fetch('' + url);
        const data = await response.json();
    } catch (exception) {
        console.log('Connection issue');

Free Deploy 😍

  • Deploy on Heroku
See also  PHP 7 pdftk Library Script to Build a Advanced PDF Document Editor or Builder on Website Full Project For Beginners


  • Deploy on Vercel

Deploy with Vercel

How Deploy Works? –

Development 🍩

git clone
cd cricket-api
cd cri
php -S localhost:3001





See also  PHP 7 Script to Check If Remote Local File Exists Using Path and fopen() Function in Server Full Project For Beginners


Leave a Reply