A new technique for measuring magnetic anisotropies in thin and ultrathin films by magneto-optics