How to optimize the debouncing for a photocell (0-24 V) on Arduino Due

Depending on the nature of the sensor output, you may not need to debounce at all. Is it a switched output, or a variable voltage?

If it's switched, you can debounce in the software rather than adding additional circuitry. If it i a variable voltage, then some hysteresis may be needed. That too can be accomplished in the software.

As for internet access, there are examples in the Ethernet library. Look at those as some of them sound similar to what I think you want to do.