A voir également:
- PHP - Récupération Browser visiteur
- Baidu browser - Télécharger - Navigateurs
- Easy php - Télécharger - Divers Web & Internet
- Avant browser - Télécharger - Navigateurs
- Tor browser - Télécharger - Confidentialité
- Convertisseur récupération de texte - Guide
1 réponse
C'est parce que tu recherche les mauvaises string. Utilise plutot quelquechose du genre:
<?php
$useragent = $_SERVER[`HTTP_USER_AGENT']);
if (preg_match(`|MSIE ([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = `IE';
} elseif (preg_match( `|Opera ([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = `Opera';
} elseif(preg_match(`|Firefox/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = `Firefox';
} elseif(preg_match(`|Safari/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = `Safari';
} else {
// browser not recognized!
$browser_version = 0;
$browser= `other';
}
print "browser: $browser $browser_version";
?>
<?php
$useragent = $_SERVER[`HTTP_USER_AGENT']);
if (preg_match(`|MSIE ([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = `IE';
} elseif (preg_match( `|Opera ([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = `Opera';
} elseif(preg_match(`|Firefox/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = `Firefox';
} elseif(preg_match(`|Safari/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = `Safari';
} else {
// browser not recognized!
$browser_version = 0;
$browser= `other';
}
print "browser: $browser $browser_version";
?>