How to use a Phototransistor and photodiode?
Like regular transistor a photo-transistor is made with a base, an emitter and a collector but the base is sensible to light allowing more or less current passing through it. So when the base is illuminated your photo-transistor is in saturation state like a regular one.

But in your application I think using a IR diode is not going to be enough. Maybe using a laser pointer is more effective.