Curl tweeks - redirects and handling response code