Optocoupler Rf calculation
Do NOT connect collector to VCC and emitter to the ground directly because your optocoupler will be broken if the transistor ON.

Use this circuit for using optocoupler 



With this circuit, we can calculate R1.

R1 = (Vin - Vf)/If

Based on this datasheet, dioda forward voltage maximum Vf = 1.3v. If = 1 mA for saturation. We can use 5 mA (maximum 50 mA) to make sure the transistor saturated.

So,

For Vin= 48 volt, R1 = (48-1.3)/0.005 = 9340 Ohm 

For Vin= 110 volt, R1 = (110-1.3)/0.005 = 21740 Ohm 

Using resistor 10k (0.5 Watt) for 48 volt and 20k (1 Watt) for 110 volt is fine.