Skip to content

Instantly share code, notes, and snippets.

@koreapyj
Created March 27, 2018 16:23
Show Gist options
  • Save koreapyj/dde38f8f5b85a19f7f7d291a32ac0d0b to your computer and use it in GitHub Desktop.
Save koreapyj/dde38f8f5b85a19f7f7d291a32ac0d0b to your computer and use it in GitHub Desktop.
SKT 피쳐폰 User-Agent 파서
<?php
function parseSKTUA($UAString) {
if(!preg_match('/^(010|011|016|017|018|019|IRM)([0-9A-F])([0-9A-F])(.{2})([0-9A-Z]{2})([0-9]{2})([0-9]{2})([0-9]{3})([0-9]{3})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{8})\s*(?:;|$)/', $UAString, $match)) {
return false;
}
return array_combine([ 'FULL_STRING', 'CDMA_MIN_PREFIX', 'SERVICE_TYPE', 'HANDSET_TYPE', 'VENDOR', 'VENDOR_TYPE', 'BROWSER_TYPE', 'VERSION', 'SCREEN_WIDTH', 'SCREEN_HEIGHT', 'SCREEN_COLUMN', 'SCREEN_ROW', 'COLOR_DEPTH', 'CDMA_MIN', ], $match);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment