It seems like you are trying to reset your iPhone but you are unable to sign out iCloud and you are getting the message that the 'Verification Failed. Error connecting to the Apple Sever'. I know it is important to be to sign out and erase your iPhone. Have you tried to sign out on a different network? If you haven't done so already, please try to use either the cellular network or a different Wi-Fi network to attempt to sign out.
Let me know how that goes and if you've recently restarted your iPhone.
Take care.