Foros del Web » Programando para Internet » PHP »

Utilizar get_browser() si poder editar php.ini

Estas en el tema de Utilizar get_browser() si poder editar php.ini en el foro de PHP en Foros del Web. me salen 4 errores http://alexandre.alapetite.fr/doc-al...ml#utilisation Utilisation Installation 1. Download the php-local-browscap module (1.4) and rename it php-local-browscap.php (2008-01-17) 2. Download php_browscap.ini from Gary Keith and ...
  #1 (permalink)  
Antiguo 18/01/2010, 12:33
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 2 meses
Puntos: 1
Utilizar get_browser() si poder editar php.ini

me salen 4 errores

http://alexandre.alapetite.fr/doc-al...ml#utilisation
Utilisation
Installation
1. Download the php-local-browscap module (1.4) and rename it php-local-browscap.php (2008-01-17)
2. Download php_browscap.ini from Gary Keith and rename it browscap.ini

estos 2 passos ja estan bien configurados

Código PHP:
Warningsyntax errorunexpected $endexpecting ']' in ./browscap.ini on line 49 in /var/www/html/php/php-local-browscap.php on line 72

Warning
uksort() expects parameter 1 to be array, boolean given in /var/www/html/php/php-local-browscap.php on line 74

Warning
array_map() [function.array-map]: Argument #2 should be an array in /var/www/html/php/php-local-browscap.php on line 75

WarningInvalid argument supplied for foreach() in /var/www/html/php/php-local-browscap.php on line 78
stdClass Object 
( ) 

dice que se puede utilizar esta librería pero no se como empezar

Código PHP:
How to use this library


You just have to call the get_browser_local
() function with:


$user_agent=null (implied)

    
The signature of the browser to be analysed. If this parameter is left to null,
    
then it uses $_SERVER['HTTP_USER_AGENT'].
$return_array=false (Implied)

    
When this parameter is activatedthe function returns an array instead of an object.
$db='./browscap.ini' (Impliednot in the native function)

    
Allows specifying the path of the browscap.ini database,
    
otherwise assumes that it is in the current directory.
$cache=false (Impliednot in the native function)

    
Specify if the database can be kept in memoryto improve performances when querying this function more than once.
return

    
Returns an object (or an array, if asked to do so in the second parameterwith the capacities of the browser
  #2 (permalink)  
Antiguo 18/01/2010, 14:14
 
Fecha de Ingreso: enero-2010
Mensajes: 191
Antigüedad: 14 años, 3 meses
Puntos: 7
Respuesta: Utilizar get_browser() si poder editar php.ini

Supongo que utilizaste el archivo correcto, no?

http://browsers.garykeith.com/stream.asp?PHP_BrowsCapINI

Proba poniendo en el mismo directorio que el script el archivo browscap y esto:

Código PHP:
function php_get_browser($agent NULL){
$agent=$agent?$agent:$_SERVER['HTTP_USER_AGENT'];
$yu=array();
$q_s=array("#\.#","#\*#","#\?#");
$q_r=array("\.",".*",".?");
$brows=parse_ini_file(dirname(__FILE__)."/php_browscap.ini",true);
foreach(
$brows as $k=>$t){
  if(
fnmatch($k,$agent)){
  
$yu['browser_name_pattern']=$k;
  
$pat=preg_replace($q_s,$q_r,$k);
  
$yu['browser_name_regex']=strtolower("^$pat$");
    foreach(
$brows as $g=>$r){
      if(
$t['Parent']==$g){ 
        foreach(
$brows as $a=>$b){
          if(
$r['Parent']==$a){ 
            
$yu=array_merge($yu,$b,$r,$t);
            foreach(
$yu as $d=>$z){
              
$l=strtolower($d);
              
$hu[$l]=$z;
            }
          }
        }
      }
    }
    break;
  }
}
return 
$hu;


Etiquetas: poder, utilidades
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:39.