We formulate a numerical scheme to investigate the correlation of photons scattered by a two-level atom coupled to a waveguide, and compute the second-order correlation function. We also show that a three-dimensional resonance fluorescence experiment can be mapped into the one-dimensional situation studied here. The correlation functions for both cases show excellent agreement.