Овој сервис ги детектира уредите и враќа податоци за нив. Работи според "User Agent".
* Сервисот е во BETA верзија и можни се грешки посебно кај податоците за уредите кои не се на Android OS.
Потребно е да сте најавен корисник за да можете да го користите сервисот.
Најавата / регистрацијата ја упростивме на најлесниот можен начин. Потребно е само да се најавите со вашиот Google / Gmail профил. После најавата во полето за токен (подоле) ќе можете да го користите Вашиот личен токен на PHP.mk сервисите.
Личен токен
За да се прикаже токенот, потребна е најава!
Верзија ({верзија}): v1.0
User Agent на прелистувачот ({userAgent}): ?userAgent= пр. "Mozilla/5.0 (Linux; Android 5.1.1; SM-J320FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Mobile Safari/537.36"
Сервис end-point
HTTP/GET https://api.php.mk/device/{верзија}?token={token}&userAgent={userAgent}
Пример HTTP/GET request
https://api.php.mk/device/v1.0?token=&userAgent=Mozilla%2F5.0%20%28Linux%3B%20Android%205.1.1%3B%20SM-J320FN%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F84.0.4147.125%20Mobile%20Safari%2F537.36
Пример PHP
$url='https://api.php.mk/device/v1.0?token=&userAgent='.urlencode($_SERVER['HTTP_USER_AGENT']); $jsonResponse=file_get_contents($url); $response= json_decode($jsonResponse,true); echo '<pre>'; print_r($response['data']); exit();
Пример cUrl
curl -X GET 'https://api.php.mk/device/v1.0?token=&userAgent=Mozilla%2F5.0%20%28Linux%3B%20Android%205.1.1%3B%20SM-J320FN%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F84.0.4147.125%20Mobile%20Safari%2F537.36';
Пример Javascript
var xhr = new XMLHttpRequest(); xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { var response_data=JSON.parse(this.responseText).data; console.log(response_data); } }); xhr.open("GET", "https://api.php.mk/device/v1.0?token=&userAgent="+escape(navigator.userAgent)); xhr.send();
Пример jQuery / JavaScript
$.getJSON('https://api.php.mk/device/v1.0?token=&userAgent='+escape(navigator.userAgent),function(r){ console.log(r.data); }).error(function(error){ console.log(error.responseJSON.msg); });
Одговорот е секогаш во JSON формат
Одговорот од сервисот се податоците за бараниот уред во JSON формат.
Пример од одговор
{ "error": false, "status_text": "OK", "status_code": 200, "data": { "user_agent_id": "10e666b54535190485e740ac8f338b67", "user_agent": "Mozilla\/5.0 (Linux; Android 4.2.2; GT-P3113 Build\/JDQ39) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/42.0.2311.111 Safari\/537.36", "platform": "Android", "platform_details": "Linux; Android 4.2.2; GT-P3113 Build\/JDQ39", "browser": "Chrome", "browser_version": "42.0.2311.111", "mobile": "Android", "robot": "", "languages": "", "device_name": "Samsung Galaxy Tab 2 7.0 P3110", "device_image": "data:image\/jpeg;base64,\/9j\/4QAYRXhpZgAASUkqAAgAA...", "device_released": "Released 2012, May", "device_body": "344g, 10.5mm thickness", "device_os": "Android 4.0.3, up to 4.2.2, TouchWiz UX UI", "device_storage": "8GB\/16GB\/32GB storage, microSDXC", "device_display_size": "7.0\"", "device_camera_pixels": "3 Mega Pixels", "device_ram_memory": "1 GB", "device_battery": "4000 mAh", "device_comment": "Tablet with no support for GSM voice communication, SMS, and MMS Also known as Samsung Galaxy Tab 2 (7.0)", "device_details_network": [ { "property": "Technology", "value": "No cellular connectivity" }, { "property": "2G bands", "value": "N\/A" }, { "property": "GPRS", "value": "No" }, { "property": "EDGE", "value": "No" } ], "device_details_launch": [ { "property": "Announced", "value": "2012, February. Released 2012, May" }, { "property": "Status", "value": "Discontinued" } ], "device_details_body": [ { "property": "Dimensions", "value": "193.7 x 122.4 x 10.5 mm (7.63 x 4.82 x 0.41 in)" }, { "property": "Weight", "value": "344 g (12.13 oz)" }, { "property": "SIM", "value": "No" } ], "device_details_display": [ { "property": "Type", "value": "PLS LCD capacitive touchscreen, 16M colors" }, { "property": "Size", "value": "(~58.2% screen-to-body ratio)" }, { "property": "Resolution", "value": "600 x 1024 pixels, 16:9 ratio (~170 ppi density)" } ], "device_details_platform": [ { "property": "OS", "value": "Android 4.0.3 (Ice Cream Sandwich), upgradable to 4.2.2 (Jelly Bean), TouchWiz UX UI" }, { "property": "Chipset", "value": "TI OMAP 4430" }, { "property": "CPU", "value": "Dual-core 1.0 GHz" }, { "property": "GPU", "value": "PowerVR SGX540" } ], "device_details_memory": [ { "property": "Card slot", "value": "microSDXC (dedicated slot)" }, { "property": "Internal", "value": "8GB 1GB RAM, 16GB 1GB RAM, 32GB 1GB RAM" } ], "device_details_main_camera": [ { "property": "Single", "value": "3.15 MP" }, { "property": "Video", "value": "720p@30fps" } ], "device_details_selfie_camera": [ { "property": "Single", "value": "VGA" } ], "device_details_sound": [ { "property": "Loudspeaker", "value": "Yes, with stereo speakers" }, { "property": "3.5mm jack", "value": "Yes" } ], "device_details_comms": [ { "property": "WLAN", "value": "Wi-Fi 802.11 b\/g\/n, Wi-Fi Direct" }, { "property": "Bluetooth", "value": "3.0, A2DP" }, { "property": "GPS", "value": "Yes; GLONASS" }, { "property": "Radio", "value": "No" }, { "property": "USB", "value": "2.0, USB On-The-Go" } ], "device_details_features": [ { "property": "Sensors", "value": "Accelerometer, gyro, compass" } ], "device_details_battery": [ { "property": "Type", "value": "Non-removable Li-Ion 4000 mAh battery" }, { "property": "Stand-by", "value": "Up to 1070 h" }, { "property": "Talk time", "value": "93 h (media player)" } ], "device_details_misc": [ { "property": "Colors", "value": "Black, White, Red" }, { "property": "SAR EU", "value": "0.63 W\/kg (head)" }, { "property": "Price", "value": "About 150 EUR" } ] } }