I know nothing about PHP, but nobody has jumped in so far, so I will make a half-useful suggestion.
Download the latest version of net_monitor and look in the
examples directory. The examples contain the strings DNS and HTTP in several places.
I hope this is enough to get you started.