We introduce a technique for the measurement of femtosecond optical pulses. This technique significantly reduces the uncertainty coming from the filter when used in the traditional technique, and an accurate spectral phase is retrieved. With the retrieved phase, the electric field, phase, waveform, as well as the duration of femtosecond optical pulses can be precisely reconstructed. The simulated autocorrelation traces deduced from the reconstructed pulsed electric field are in good agreement with the measured ones. This technique removes the manual procedure of selection and adjustment of the filter, an automatic measurement being realized.