Making cURL requests following redirects