Optocoupler with 220V DC
Assuming this is a one-off project, this is what you can do:


Obtain a 220 Volt incandescent miniature night light bulb, of power rating 2 to 8 watts, such as the ones on this page.
Use an optocoupler like the PC817, that can withstand 50 mA current on the input LED, but works from as little as 5 mA or so.
Connect this lightbulb in series with the optocoupler's input:








simulate this circuit &ndash; Schematic created using CircuitLab

The incandescent light is not affected by supply voltage being DC or AC. 

At the wattage suggested, the current through the bulb would be between 9 and 30 mA. This is sufficient to operate the optocoupler.