Can you please shade some more light om this idea?
Simple. Remove the capacitors.
Here's a distillation of all the ideas presented so far:

Adjust the values as needed.
I set the max LED current to around 550µA. I set it relatively high, so the Opto's transistor gets driven way into saturation, to produce a nice square-ish wave on the output.
So, at 220VAC, that's a peak voltage of 220VAC * √2 = 311V
311V minus the Opto diode's forward drop of around 1.1V = 310V
310V/550µA = 563k
563k - 24k = 539k which is the desired capacitive reactance of C1, at 50Hz.
Using the formula for Capacitive Reactance we get the following capacitor value:
C = 1/(2*π*50*539k) = 5.9 nF and the closest standard value to that is 5.6nF, or 5600pF. I would use an "Open Mode" Class-Y, fail safe AC capacitor [Y1 or Y2].
I chose 24k for the resistor to limit current to the Opto's photo diode to within it's max operating range, should a high frequency spike come along. Assuming these events are few, and fast, nothing should blow -- if you expect more noise, and nastiness, then, perhaps, bump that up, or make it a higher wattage.