The sample above is good for blocking undesired content (not only URL’s). So I don’t think it is applicable for the reversed solution.
Basically you have several possibilities:
1) Allow only those IP’s which host permitted URL’s. If outgoing HTTP packet (with destination port 80) is destined to the IP address not in the list then just drop it.
2) Parse outgoing DNS packets and allow only those queries which are allowed in your URL list.
3) Parse HTTP GET request for each outgoing HTTP packet and match URL against your URL list.