its not just the foam that you want. Ideally, if using a top fermenting yeast, after a couple of days the foam will change to a more creamy texture. This is yeast, skim some of this off with a sanitised spoon into a sanitised container, shove a lid on it and put it in the fridge..dont take it all off as this is protecting your precious beer.
It will keep for a few weeks in the fridge but will not be as viable as time goes on.