Detecting a CD-Rom

From: Date: Fri, 16 Sep 2005 04:25:06 +0000
Subject: Detecting a CD-Rom
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-6204@lists.php.net to get a copy of this message
Hi there! I'm trying to determine if a specific CD-ROM is in the CD drive. If the correct CDROM is in the drive, then the program will download some data from the CDROM, otherwise it will go to the Internet to get it. Currently, I've got code something like: $source='http://mywebsite.com/secretfile'; $drives=array('d', 'e', 'f', 'g'); foreach($drives AS $drive) if (file_exists("$drive:/secretfile")) if (CanIndexList("$drive:/secretfile")) $source="$drive:/secretfile"; This usually does find the CDROM just fine when it's entered, but if it isn't, the user gets a message from the Windows OS notifying them that there's a problem reading the cd. This is especially a problem when a user has 2 or 3 CDROM drives in their system! Also, sometimes the CDROM is on a higher drive than F, in which case the above does not work. Nothing in $_ENV or $_SERVER seems to give any clue on this, and repeated searching at php.net as so far revealed nothing. How can I "politely" check for the existence of a CDROM in a drive, and how can I find out which drive is the cdrom? -Ben -- "The best way to predict the future is to invent it." - XEROX PARC slogan, circa 1978

« previous php.gtk.general (#6204) next »