DNS implementation in pure PHP