method to extract cookie