You both are missing the point, cant see the forest for the trees, lost in the minutia
The script request DOES NOT= REQUIREMENT.
Why? Simply a configuration has a task to perform to meet requirements. You are discussing tasks because the OP framed the request in such a way that fooled you.
Analogy. Op asks on forum, how do I design the internal mechanism on a plastic pistol. The requirement is to be able to kill someone,,,,,,, now do you really want to help a person do that ;-P
So it was a poor analogy LOL.
In other words, the OP has to confess THE WHY he wants such a script.
Since the OP is afraid of the truth we can only surmize that they are attempting to block websites from users on his LAN.
We know that to be a fools game with MT equipment, especially if the URLS are HTTPS.
So get your heads out of the sand and inform this poor chap that no matter how gucci, suave, sophisticated the scripts you foam at the mouth with like excited puppies, it AINT gonna resolve the requirement.
I could be wrong, but will leave you to decide............