Haven't actually managed to try this with the most recent version yet, but in 40d it went something like this:
--d---------d--
- - -
- b---b -
- b+S+b -
- r b+ +b r -
- b-d-b -
- b-c-b -
- b b -
---------------
'-' is a wall
'b' is a bridge
'+' is a fortification
'c' is a cage trap
'r' is a restraint
'S' is the spider
'd' is a door.
You set up the spider in a cage with a lever somewhere outside the room to release it. You put a dog or some other suitable pet on each restraint. You set the door right next to the spider to "allowed", but *not* pet-passable. With the bridges down the spider can see the animals, path to the animals, but it can't *actually* go through the door. It should then shoot webs.
When enough has been dropped on a given side, you put up the bridge on that side. The spider can no longer see or path to one of the pets, and any dwarves wanting to enter can do so without getting scared by the spider. When you've collected all the webs, you lower the bridge on that side and raise it on the other, where by now there will be lots of silk to be collected. The cage trap shouldn't be necessary, but is there in case you accidentally let the door open.
There are improvements that can be made (and you'll probably want the collection chambers larger then in the diagram) but this is the basic idea. One improvement that you *can't* to my knowledge make is to make the spider's chamber only one square - the parts from the opened cage trap will jam open the door.
Oh, and don't tame the spider or it won't shoot at pets, which makes the whole thing more difficult.