Turn CURLOPT_FOLLOWLOCATION off to prevent the redirect from taking place; obtain the response headers and look at the Location: field.
I say all this without having made any sort of attempt at trying it myself; it's based entirely on looking in the manual.