Page 1 of 1

Opening a CD-ROM tray with PHP

Posted: Fri Dec 03, 2004 9:52 pm
by evilmonkey
Does anyone know how to do it? I thought it'd be pretty cool. I know in Linux, there's an eject command that can be executed through exec(). How about in Windows? This is just something cool, wondering how to do it for further reference.

Cheers!

Posted: Fri Dec 03, 2004 10:35 pm
by dull1554
well if you did it it owuld open the tray on the server because php is serverside and not client side in any manner......

but hey what does little old me know.... :)

Posted: Fri Dec 03, 2004 10:57 pm
by nigma
dull1554 wrote:but hey what does little old me know.... :)
Pull yourself together man! You're supposed to be a master.

Re: Opening a CD-ROM tray with PHP

Posted: Fri Dec 03, 2004 11:17 pm
by Weirdan
evilmonkey wrote:Does anyone know how to do it? I thought it'd be pretty cool. I know in Linux, there's an eject command that can be executed through exec(). How about in Windows? This is just something cool, wondering how to do it for further reference.
In windoze you can do virtually anything via com objects. PHP/Win does support COM, hence you can open cd tray of a windows server. Here's VBScript code:

Code: Select all

Const CDROM = 4
For Each d in CreateObject("Scripting.FileSystemObject").Drives
  If d.DriveType = CDROM Then
    Eject d.DriveLetter & ":"
  End If
Next

Sub Eject(CDROM)
  Dim ssfDrives
  ssfDrives = 17
  CreateObject("Shell.Application")_
    .Namespace(ssfDrives).ParseName(CDROM).InvokeVerb("E&ject")
End Sub
Translating it into PHP code should be fairly simple and straightforward.

Posted: Sat Dec 04, 2004 12:08 pm
by evilmonkey
dull1554 wrote:well if you did it it owuld open the tray on the server because php is serverside and not client side in any manner......

but hey what does little old me know.... :)
Yes, but nowdays you can make PHP-GTK applications that run on Windows. ;)

Wierdan, thanks for the hint. :)

Posted: Sat Dec 04, 2004 4:30 pm
by Shendemiar
nigma wrote:
dull1554 wrote:but hey what does little old me know.... :)
Pull yourself together man! You're supposed to be a master.

Lol :D

Posted: Sat Dec 04, 2004 4:39 pm
by nigma
:roll: Well, it's true.

Posted: Sat Dec 04, 2004 9:04 pm
by dull1554
i wish i could give myself my own rank, it would be "COMPLETE MORON"

but hey......

im just gonna stop now

....and evilmonkey im gonna have to look into that PHP-GTK stuff sounds like it could have potential

Posted: Sun Dec 05, 2004 9:18 am
by timvw
nah, we like wxPython more ;)