A fluid dispensing machine, such as a peritoneal dialysis or hemodialysis machine, includes a dispenser or cassette that pumps a medical fluid for dialysis or other treatments for patients. The machine includes and uses an autoconnect device for connecting containers of liquid, such as bags of dialysis fluid or medication fluids, to the machine, while maintaining the sterility of the connection. The autoconnect device removes the cap from the fluid bag and pierces a sealing membrane on tubing from the bag. This makes it easier for patients to receive treatment, especially home treatment. The cassettes preferably have tubing ports with integral spikes for piercing the membrane on tubing from bags of liquids. The ports may be staggered for sequential engagement with the spikes. Other embodiments are useful for dispensing other liquids from other types of dispensing or pumping machines.