ddjamel / gsmarena-API

cURL and return Array or JSON

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

DEMO

About

cURL and return Array or JSON

License:MIT License


Languages

Language:PHP 100.0%