Updated the cURL script to follow redirects