Troubleshoot internet connection over wifi in public on iphone 5C
There's a good chance the WiFi you connect to actually might not have a working internet connection but is still broadcasting a WiFi signal. I suggest you to try and connect another device and see if the same helps.

Also, as the comment above suggests you may need to log into the network for the same to allow you to use the internet. To login, you should see a login screen right after joining the network or try opening any website from Safari, that will make the login screen show up too.