Hmm.. in the browser headers there usually is the Operating System they are on however you must now the headers to be able to convert that OS to its correct Operating System Name. However yes its true PHP cannot get there CPU, screen resolution.

[ rapmonkey]

There is no other way that i know of besides javascript the only thing there is that it can be turned off. However email your host about configuring the browser.ini basically its just a download and just put the correct path to the file in the php.ini

    I got this to work by loading a php.ini and browscap.ini into the dir and doing a system call to a php script to send back the get_browser() info.

    This way php used the local copy of php.ini and not the default one.
    A hard way to get something so simple, but it worked.

    $info = /usr/local/bin/php getbrowser.php

    <?
    print_r( get_browser() );
    ?>

      So you mean by just putting this code, it will print what I want?

      <?php
      $info = `/pathtofile.ini` 
      print_r( get_browser() ); 
      ?>

        In your main script put the system call

        $info = /usr/local/bin/php getbrowser.php

        in a seperate file called getbrowser.php put
        <?
        print_r( get_browser() );
        ?>
        Make sure you have edited php.ini to point to the browscap.ini
        and that it is in the same dir as getbrowser.php

          This should work, but it seems I have something wrong with my foreach statement. This code:

          <?
          $info = `/home/ getbrowser.php`;
          
          foreach ($info as $item => $val) {
          echo "<b>$item</b> $val <br />\n";
          }
          ?>
          

          Returns this error:

          Warning: Invalid argument supplied for foreach() in /home/main.php on line 35

            That means you are not getting an array into $info

            could it be:

            $info = /home/getbrowser.php;
            instead?

              I can't get it. 🙁

              Here is how everything is set up.

              /home/scripts contains main.php, getbrowser.php, browscap.ini, and php.ini. main.php has the following code:

              <?php
              $info = `/home/scripts/getbrowser.php`;
              
              foreach ($info as $item => $val) {
              echo "<b>$item</b> $val <br />\n";
              }
              ?>

              getbrowser.php has the following code:

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

              Yet I get this error: Warning: Invalid argument supplied for foreach() in /home/scripts/main.php on line 37

              What is going wrong?

                oops, didnt read carefully.

                Basically, HalfaBee's idea is to use the PHP interpreter from command line.

                //main script
                $info = `/path/to/php getbrowser.php`;
                print_r($info); //see if it is correct
                
                //getbrowser.php
                <?php
                print_r(get_browser());
                ?>

                  I tried this earlier...No error, but no output either.

                    Still having a problem...Now I get no errors but no output. I'm not quite sure I understand the PHP interpreter via the command line. How does this work?

                      Try doing
                      <?
                      passthru('ls -la /usr/local/bin/php' );
                      ?>

                      to see if it is actually there.

                      You can also do this to see where it is
                      <?
                      echo '<PRE>';
                      passthru( 'locate php' );
                      ?>

                      PHP is just a program that you can run on the server.
                      Just like doing ls or ps

                        The first command returns this:

                        rwxr-xr-x 1 root root 7429677 Mar 9 08:02 /usr/local/bin/php

                        while the 2nd command returns a LOT of stuff. I still don't see how all of this works.🙁

                          It shows php is available and you can run it.

                            OK, getbrowser.php has this code:

                            <?php
                            //print_r( get_browser() );
                            echo get_browser($_SERVER['argv'][0]);
                            ?>

                            main.php has this code:

                            <?php
                            $info = `/path/to/dir getbrowser.php`;
                            
                            print_r($info);
                            ?>

                            /path/to/dir is the path to browscap.ini as well as php.ini and the scripts I am running (getbrowser.php and main.php). Same problem. No errors and no output.

                              Ok, this works fine for me.

                              getbrowser.php
                              <?
                              print_r( get_browser( $_SERVER['argv'][1] ) );
                              ?>

                              testscript.php
                              <?
                              echo '<pre>';
                              echo 'Trying '."/usr/local/bin/php -c ./php.ini gb.php \"$HTTP_USER_AGENT\"\n";

                              passthru( "/usr/local/bin/php -c ./php.ini gb.php \"$HTTP_USER_AGENT\" ",$ret );
                              if( $ret !=0 )
                              echo "passthru failed $ret";
                              else
                              echo 'passthru worked' ;

                              ?>

                              It only echo's the data to the screen, but I am sure you can work out how to parse the data.

                                That script returned this:

                                Trying /home/public_html/scripts -c ./php.ini getbrowser.php "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
                                passthru failed 126

                                  You are taking out the call to php and replacing it with /home/public_html/scripts

                                  Just cut and paste what I posted and it should work if the two files are in the same dir.

                                    I think I'm getting closer. This time the script returned this:

                                    Trying /usr/local/bin/php -c php.ini getbrowser.php "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
                                    Could not open input file: getbrowser.php.
                                    passthru failed 1

                                      Is getbrowser.php is the same dir?
                                      You could try ./getbrowser.php otherwise.

                                        main.php
                                        getbrowser.php
                                        php.ini
                                        browscap.ini

                                        all those files are in the same directory, which is /home/scripts