We all know, mostly from watching cartoons, that if you are stranded in the desert you can get water out of a cactus. However, the usual cartoon method for extracting it (pulling a spigot from one's pocket and inserting it into the cactus) is not likely to be successful in an actual dying-of-thirst situation.

If you're lost in the desert, getting water is very, very, very important. You'll need to drink a pint of water every hour - and if the temperature is over 100F, make that a quart an hour. Urine, blood, saltwater, and booze are NOT recommended - all of these require more water to digest and/or excrete than they contain. (but don't despair - blood (not your own, dummy) is food, and fresh urine is a good antiseptic - so they are good for something!). One good way to require less water is to not eat so much. In fact, don't eat at all. But drink everything you can (don't ration your water - chug it!)

More general information on desert survival can probably be found in other nodes, so I'm going to get on with this cactus thing.

OK, so you're stranded, thirsty, and have nothing around but cacti. The proper way to do this is to cut off the top of a barrel cactus, and mash up the pulp (such as by chewing). Suck or pour out the liquid, but don't eat the pulp. Be aware that cutting open the cactus is going to be difficult if you don't have a machete. Also, be careful about the type of cactus. If you're outside the US, the cacti you encounter will almost certainly be the correct species; but within the US, there are many types of cacti and many are poisonous. Also, barrel cacti are protected by many state and park laws, so don't do it just for kicks.

Another way to use cacti, which is likely safer, is to make a still. Stills don't work very well at producing water, but they're good at purifying it. Dig a great big hole, put a bucket in the middle, and stretch a tarp over the top. You'll want to line the still with something wet, such as ... chopped-up cactus! The heat will evaporate the water. The water will collect on the tarp, and then will drip down toward the lowest part of the tarp (located under a strategically-placed rock) and into the bucket.

In the meantime, there are other ways to obtain water in the desert: find little holes and fissures where rain may have fallen, and suck it out with flexible tubing. If you can't find water in fissures, but you do have a crashed vehicle nearby, wait for condensation to form on it, and sponge it off with cloth. Wring out the water into your sorry excuse for a drinking cup. Or, if you can find any damp sand or green vegetation, dig a hole and see if water seeps into the hole. Green vegetation (of any sort, but preferably not cacti) allows you what might be the best means of obtaining water: put a plastic bag over a plant with leaves. When the leaves "sweat" (this is transpiration), the inside of the bag will be covered in water. Cacti have a very special way of saving water that involves little transpiration, so if you're in a bone-dry, cacti-only desert you may be screwed.

References and further reading:
U.S. Army Survival Manual
http://www.death-valley.us/article245.html
http://www.southwest-vacation-travel.net/four-corners/desert-survival-skills/water.htm