I think, ssuming that there are no hidden ingredients (no hotstuffing), you would start by having 1 of everything, hit the correct crafting page, parse the dropdown with every crafting ingredient you own, and try that. And you would want to ignore every recipe that's already known. And rebuy everything used up, unless it's too expensive.
What happens if you try to craft.php an existing recipe when you don't have the ingredients (and don't know the recipe yet)? (presumably it says that you don't have the items you are trying to smash together, which is useless for detecting whether they would actually make something, but you never know until somebody tries it)