Sometimes You may need to buy a good stain remover or hire a professional carpet cleaner.
Here are some tips to remove the stains from your carpet
(1) You can use water as one of the best cleaning solvents.
(2) The most important thing for cleaning any stain is to clean the spilled matter immediately.
(3) Don't scrub the stain, this will only weaken the carpet fibers and cause the stain to spread. Blotting gently will remove the stain without causing any damage.
(4) You can use dish washing liquid/club soda/vinegar onto the stain to clean.