Plug your iron into the closest outlet to the stained area (or use an extension cord, if necessary) and allow it to heat up for a minute or two.
Fill a spray bottle with a mixture of equal parts ammonia and hot water, then replace the spray top and shake to combine.
Spray the ammonia mixture liberally over the carpet stain, then spread a clean towel over the top of it.
Place your iron onto the towel, moving it around slowly to avoid singeing the carpet. After a few seconds, pull back one edge of the towel and have a look. You should see that quite a bit of the stain has transferred to the cloth.
Spray more of the diluted ammonia onto the stain to keep it moist, then continue ironing, switching to a clean towel as needed. (You may have to use a few towels depending on the severity of the stain.)
When the stain is gone, let your carpet dry completely before walking on it again.