First I am
guessing that this is wall to wall carpeting. If so it is most likely a nylon fiber (most common but that is not an absolute) and the best solution is to have it professionally cleaned. Cleaning of this is as with most any carpet from most any fiber.....it is best to be done quickly and before the stain is "ground in".
See http://www.carpet-rug.org/residential-customers/cleaning-and-maintenance/basic-cleaning/cleaning-spots-and-spills.cfm
Unfortunately, if this has been going on for several months, I suspect your best option will be to replace it.
Jim B.
www.ItsAboutRugs.com