Error 56 has something to do with the hardware and those who encounter this error are advised to contact Apple Support should the error message persists. But before you do so, you can try any of these potential solutions and workarounds to deal with it:

Reboot your iPhone.
Restarting the device can help eliminate software glitches that may have caused you trouble connecting to the Internet. To reboot your device, press and hold the Power (Sleep/Wake) button until the red slider shows up. Drag the slider to power off your iPhone completely. After a few seconds, press and hold the Power button again until the Apple logo appears.

Verify Wi-Fi settings.
Ensure Wi-Fi is enabled and that you can see your wireless network. To do this, head on to your phone Settings-> Wi-Fi. Toggle the Wi-Fi switch to enable the feature, if necessary. To join a Wi-Fi network, tap the name of the wireless network you want to join. If prompted with the network passcode, enter the correct Wi-Fi password to proceed. Once you see the blue checkmark next to the network name, it means you’re already connected.

Try to disable any third-party security software installed on your iPhone.
Sometimes, third-party security software interfere your iPhone’s connectivity functions. Having that said, it would be worth a shot to disable it temporarily and see what happens after that.

Reboot or power-cycle your wireless router and modem.
Power-cycling Internet equipment including the wireless router and modem often helps resolve problems connecting to the Internet. Here’s how it’s done:

Turn the router/modem off.
Unplug it from the power out.
Wait for 30 seconds.
Plug them back in.
Turn them on again.
Wait for the router and modem to re-establish connection to the network.
Reboot your iPhone.
Disconnect and reconnect to your wireless network.
Open a browser and test browse.
Also ensure the cables and connections from the wireless router to the modem (vice-versa) are all firmly secured.

Reset Network Settings.
Resetting of the network settings will revert the network settings to factory defaults, and therefore eliminates glitches that are triggered by incorrect configuration of the network options. However, this also means network information including Wi-Fi networks and passwords, cellular settings, as well as VPN and APN settings you’ve previously used will also be erased.

Restore your iPhone through iTunes.
If the problem can’t be helped by any of the prior solutions, then your next option is to restore your device through iTunes. You will need a computer with the latest version of iTunes installed, in order to get this done. Once everything is all set, follow these steps:

Open iTunes on your computer.
Connect your iPhone to the computer using the USB cable that comes with the phone.
If prompted, enter the passcode for your device or Trust This Computer, and then follow the onscreen instructions to complete the process.
If you see multiple devices detected in iTunes, select your iPhone from the list to continue.
Click Restore device in the Summary panel of iTunes.
Click Restore again to confirm action.
Wait for iTunes to erase your iPhone and complete the restore process.