サンプル
初期化
<?php
require_once 'Net/UserAgent/Mobile.php';
$mobile = Net_UserAgent_Mobile::factory('KDDI-SA31 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0');
?>
name
<?php
var_dump($mobile->name);
?>
実行結果
string(10) "UP.Browser"
version
<?php
var_dump($mobile->version);
?>
実行結果
string(19) "6.2.0.7.3.129 (GUI)"
getUserAgent()
<?php
var_dump($mobile->getUserAgent());
?>
実行結果
string(48) "KDDI-SA31 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0"
getHeader($header)
<?php
echo htmlspecialchars($mobile->getHeader('REFERER'), ENT_QUOTES, mb_internal_encoding());
?>
実行結果
getName()
<?php
var_dump($mobile->getName());
?>
実行結果
string(10) "UP.Browser"
getDisplay()
<?php
var_dump($mobile->getDisplay());
?>
実行結果
object(Net_UserAgent_Mobile_Display)#162 (6) {
["_width"]=>
int(0)
["_height"]=>
int(0)
["_depth"]=>
int(0)
["_color"]=>
bool(false)
["_widthBytes"]=>
int(0)
["_heightBytes"]=>
int(0)
}
getVersion()
<?php
var_dump($mobile->getVersion());
?>
実行結果
string(19) "6.2.0.7.3.129 (GUI)"
noMatch()
<?php
$error = $mobile->noMatch();
echo $error->getMessage();
?>
実行結果
KDDI-SA31 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0: might be new variants. Please contact the author of Net_UserAgent_Mobile!
parse($userAgent)
<?php
var_dump($mobile->parse($userAgent));
?>
実行結果
NULL
makeDisplay()
<?php
var_dump($mobile->makeDisplay());
?>
実行結果
object(Net_UserAgent_Mobile_Display)#164 (6) {
["_width"]=>
int(0)
["_height"]=>
int(0)
["_depth"]=>
int(0)
["_color"]=>
bool(false)
["_widthBytes"]=>
int(0)
["_heightBytes"]=>
int(0)
}
isDoCoMo()
<?php
var_dump($mobile->isDoCoMo());
?>
実行結果
bool(false)
isJPhone()
<?php
var_dump($mobile->isJPhone());
?>
実行結果
bool(false)
isVodafone()
<?php
var_dump($mobile->isVodafone());
?>
実行結果
bool(false)
isEZweb()
<?php
var_dump($mobile->isEZweb());
?>
実行結果
bool(true)
isAirHPhone()
<?php
var_dump($mobile->isAirHPhone());
?>
実行結果
bool(false)
isNonMobile()
<?php
var_dump($mobile->isNonMobile());
?>
実行結果
bool(false)
isTUKa()
<?php
var_dump($mobile->isTUKa());
?>
実行結果
bool(false)
isWAP1()
<?php
var_dump($mobile->isWAP1());
?>
実行結果
bool(false)
isWAP2()
<?php
var_dump($mobile->isWAP2());
?>
実行結果
bool(true)
getCarrierShortName()
<?php
var_dump($mobile->getCarrierShortName());
?>
実行結果
string(1) "E"
getCarrierLongName()
<?php
var_dump($mobile->getCarrierLongName());
?>
実行結果
string(5) "EZweb"
isSoftBank()
<?php
var_dump($mobile->isSoftBank());
?>
実行結果
bool(false)
isWillcom()
<?php
var_dump($mobile->isWillcom());
?>
実行結果
bool(false)
getModel()
<?php
var_dump($mobile->getModel());
?>
実行結果
string(4) "SA31"
getRawModel()
<?php
var_dump($mobile->getRawModel());
?>
実行結果
string(4) "SA31"
getUID()
<?php
var_dump($mobile->getUID());
?>
実行結果
NULL