24V to optocopler (voltage drop of 22.8V)
If the IRLED in your opto drops 1.2V with 20mA through it, then the value of the ballast resistance must be:

$$R = \frac {V_{IN} - V_{LED}}{I_{LED}} = \frac{22.8V}{0.02A} = 1140\text{ ohms} $$

1100 ohms is a standard E24 value, it'll allow

$$I = \frac {V_{IN} - V_{LED}}{R} = \frac{22.8V}{1100\Omega} \approx 21 \text{ milliamperes}$$

through the LED, and it'll dissipate

$$ P = I^2R = 0.00044\times 1100\Omega \approx 0.5\text{ watt} $$ 

I'd use a 1 watt resistor, and if you want to go thru-hole, here's a link. 

If you want to go surface mount,here's a link to something that should work in your ambient temp.

Also, I've excerpted the derating curve for the surface mount resistors and it looks like at about 110C or so the 1 watt unit can dissipate half a watt or so.