Getting illegal characters in get_browser() method run in php -


from manuals running simple code fetch browser info using get_browser() method.

code in manuals -

code_in_manuals

code running(almost same/i tried removing echo "<pre>"; no effect) -

<?php echo $_server['http_user_agent'] . "\n\n";  $browser = get_browser(null, true); echo "<pre>"; print_r($browser); ?> 

this error/illegal characters getting @ browser_name_regex -

get_browser_error

i tried utf 8 encoding characters, problem still persist.

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>test browser</title> </head>  <body> <?php echo $_server['http_user_agent'] . "\n\n";  $browser = get_browser(null, true); echo "<pre>"; print_r($browser); ?> </body> </html> 

let me know doing wrong , solution?

one thing more ask, in same doc -

attempts determine capabilities of user's browser, looking browser's information in browscap.ini file.

where find browscap.ini in system using windows 7...although not sure if related problem or not.

as told found browscap.in file in given path specify absolute path c:\xampp\php\extras\browscap.ini in php.ini file like

i have in local setup (php.ini), have generated browscap file other function , pasted in file , found correct output.

[browscap] ;browscap = extra/browscap.ini browscap = d:\zendserver\etc\browscap.ini 

you can specify absolute path like

[browscap] ;browscap = extra/browscap.ini browscap = c:\xampp\php\extras\browscap.ini 

and code check

echo $_server['http_user_agent'] . "\n\n";  $browser = get_browser(null, true); echo "<pre>";print_r($browser);die; 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -