Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 805 Bytes

README.md

File metadata and controls

36 lines (27 loc) · 805 Bytes

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);