OptoCoupler as a switch (or other options?)

There are even triple optocoupler ICs out there, such as the PC837.