Believe it or not, sometimes the best carpet cleaner for general stains is ordinary shaving cream.
It will often remove just about every type of stain. Apply the shaving cream directly to the stain and let it set for about 30 minutes.
Once the shaving cream has set, blot it away with a dry white cloth. Finish by spraying the area with one part vinegar mixed with one part water and then wiping away the solution with a cloth.