I had this problem when i was using my university internet. But only there. What I did to solve the problem was use a different DNS server. You will need to edit /etc/resolv.conf and add a line "nameserver 188.8.131.52"
Thats the one I use. I am not sure what OS you are using, but generally speaking you can this from a terminal window:
sudo <texteditorhere> /etc/resolv.conf
Hope this helps