Created
March 16, 2012 08:53
-
-
Save mgng/2049207 to your computer and use it in GitHub Desktop.
DoCoMoのユーザーエージェントからCookie対応/非対応端末を調べる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$src = file_get_contents( 'http://www.nttdocomo.co.jp/service/developer/make/content/spec/useragent/' ); | |
$src = mb_convert_encoding( $src, 'UTF-8', 'SJIS-win' ); | |
preg_match_all( '/DoCoMo\/[12]\.\d(\s?)[\/a-zA-Z0-9\(\);\+]+/iu', $src, $matches ); | |
if ( ! count( $matches[0] ) ) { exit; } | |
foreach( $matches[0] as $useragent ) { | |
$flg = preg_match( '/\ADoCoMo\/2\.0.+c(\d+)/', $useragent, $m ) && (int)$m[1] >= 500 ? '○' : '×'; | |
echo "{$flg} {$useragent}\n"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… | |
× DoCoMo/2.0 F09B(c100;TJ) | |
× DoCoMo/2.0 F08C(c100;TB;W20H09) | |
× DoCoMo/2.0 F08C(c100;TB;W16H09) | |
× DoCoMo/2.0 F08C(c100;TD) | |
× DoCoMo/2.0 F08C(c100;TJ) | |
○ DoCoMo/2.0 P07A3(c500;TB;W24H15) | |
○ DoCoMo/2.0 P07A3(c500;TB;W42H08) | |
○ DoCoMo/2.0 P07A3(c500;TB;W20H12) | |
○ DoCoMo/2.0 P07A3(c500;TB;W35H06) | |
○ DoCoMo/2.0 P07A3(c500;TB;W30H18) | |
… |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment