tags:

views:

51

answers:

3

Why is there no plugin detection tecnique (like navigator.plugins) in PHP? Why it is not implemented? It would be great! Any thoughts on how to do it?

Edit: Like in $_SERVER['HTTP_USER_AGENT']

A: 

Do you want to detect php-plugins or browser-plugins?

browser-plugins:

send navigator.plugins to one of your php scripts via an ajax call.

php-plugins:

evaluate php_info() for the wanted plugin (maybe there is a more straightforward way?)

henchman
browser-plugins
ilhan
+3  A: 

For browser information in general, the server only know what the client explicitly tells it, which is typically only a user agent string. You'll have to setup an AJAX method to send any other data you may want the server to know about on a per-session basis

For PHP extensions, you can use get_loaded_extensions(). From the documentation:

Example #1 get_loaded_extensions() Example

<?php
print_r(get_loaded_extensions());
?>

The above example will output something similar to:

Array
(
   [0] => xml
   [1] => wddx
   [2] => standard
   [3] => session
   [4] => posix
   [5] => pgsql
   [6] => pcre
   [7] => gd
   [8] => ftp
   [9] => db
   [10] => calendar
   [11] => bcmath
)
Justin Johnson
so these are server extensions. more elegant than php_info. +1
henchman
A: 

no reason, no thoughts

ilhan
Deleting as not an answer (before it gets auto-deleted due to spam flags)
Marc Gravell
It is the real answer.
ilhan