There appear to be several issues with WiFi.
1.) The DNS issue. Search the forums here for help with that.
2.) A need to reset WiFi settings and start over: forget existing WiFi networks, reset network setting in settings, restart iPhone. May help, may not.
3.) WEP issue. Search the forums here for help with that.
4.) iPhone and WiFi AP not fully compatible: try a different AP (hotspot, friend, etc.).
5.) ?
In my case, on my home WLAN, I experienced issues #1 and #4. I solved #1 by overriding my AP-supplied DNS address with my ISP's DNS addresses. While that cured my DNS problem it didn't help my issue with the AP. Symptoms with my AP included very poor range, inability to hold signal, and inability to reconnect to the AP without being around 10' from the AP. Swapping APs cured this, but I happened to have a spare AP around that I wasn't using. Still had the DNS issue, but that was easily solved.
Now, when at home my WiFi works great. If by chance I do walk far enough away to lose signal (say, outside in the garage) it switches seamlessly to EDGE, and then back to WiFi when I am again in range.
Good luck!
--
Mike