What are the voltage & current ratings of output contacts of optocouplers ? whether they can withstand ac voltage or not?
Devices sold as optocouplers generally have a an output that approximates a current source, with high output impedance, which is very different than a relay. Also they generally only pass current in one direction.

Depending on what you're actually trying to do, you might want to investigate solid state relays or SSRs.