Check for an internet connection when sending a post request