You can use standard optocoupler (diode-phototransistor) as per attached drawings.
In the first circuit the voltage is dropped by a capacitor (no heat) in the second circuit the same function is achieved by a power resistor.
Regards,
IanP
What the value i need to choose for the capacitor (for AC want izit)?
the resistor i need to choose high watt, if i choose 10R? and
normal 4N25 optocouler...
Assuming that the voltage is 220Vac and the diode current will be 10mA, the resistor's value will be ≈22kΩ, or the capacitor's value ≈150nF/250Va ..
My preference is the circuit with a capacitor as there will be no heat generated by this passive component. In case of the reasistor, you will need to use one rated to at least 2.5W ..
Regards,
IanP