/gsmarena-API

cURL and return Array or JSON

Primary LanguagePHPMIT LicenseMIT

GSM Arena API (gsmarena.com)

PHP Class for grab data on gsm arena website and output Array or JSON using cURL and simple html dom.


Usage:

<?php

// Include class gsm.php
require("gsm.php");

// Create objek
$gsm = new gsm();

Brands:

$data = $gsm->getBrands();

Search:

$data = $gsm->search('zenfone'); // Keyword

Detail:

$data = $gsm->detail('asus_zenfone_max_zc550kl-7476'); // Slug

Return Array:

print_r($data);

Return JSON:

// Convert ARRAY to JSON
header('Content-Type: application/json');
echo json_encode($data, JSON_PRETTY_PRINT);