Second and third harmonic generation in the opaque region of a GaAs wafer is experimentally observed both in transmission and reflection. These harmonic components can propagate through an opaque material as long as the pump is tuned to a region of transparency or semi-transparency, and correspond to the inhomogeneous solutions of Maxwells equations with nonlinear polarization sources. We show that measurement of the angular and polarization dependence of the observed harmonic components allows one to infer the different nonlinear mechanisms that trigger these processes, including bulk nonlinearity, magnetic Lorentz and surface contributions. Experimental results are compared with a detailed numerical model that takes into account these different effects.