First vacuum the carpet then mix some liquid laundry detergent in warm water and soak the coke stain for about 10 minutes then agitate with a bristle brush. After the stain is gone remove the soap with damp towels rinsing them often then blot dry. After the carpet has completely dried use a dry bristle brush to raise the nap. This usually works much better than those store bought "carpet and upholstery" cleaners.