I think jremorgan has it backwards.
some external voltage source trigger the LED inside of the optocoupler and connect the output side of the optocoupler to a digital pin and ground, so that when the LED will be on, it will be like connecting the digital pin to ground
jremorgan sometimes gets things wrong, but jremington's circuit will clearly accomplish this task:
My idea was to connect the octocoupler in parallel to the power LED contacts (or in its place if the board can't handle the extra current needed by both its own LED and the optocoupler's one) of some appliance I cannot modify too much.
I suggest trying it in series, first. The LED in the typical OptoIsolator drops around 1.1 to 1.3V, so if there is enough "voltage headroom", you might get away with it -- though, in a remote, powered by two 1.5V batteries, maybe not. But, in a Remote Controller for, say a model Airplane--one powered by a 9V battery--or an electronic gate, with a [typical] 12V battery--then there's a good chance that will work. The Power LED might be a little dimmer, though--BUT, the amount of power used, would not increase--in fact it might go down a little.
How can I make it that the optocoupler acts as a "real" pushbutton without internal resistance?