How to use libcurl to get the final URL of a site after a redirection ?
Date: Sun, 19 Jul 2020 11:35:00 +0700
I am a beginner at libcurl.
I have installed curl 7.72.0-DEV (x86_64-pc-win32) libcurl/7.72.0-DEV
Schannel WinIDN. I work with MinGW C/C++ on Windows 7 and Windows 10.
What I wish to do.
I would like to write a function to obtain the final URL from a site which
redirects to another site using libcurl functions. I need some guidance on
this.
Example.
The site "http://site.com" redirects to
"https://www.salesforce.com/products/platform/overview".
So, I would like my function to return the final URL as an output when given
the initial URL as an input. I do not need the whole body of the redirected
page. Only the new URL.
What I have done so far.
Gone through the libcurl documentation and tried some of the examples given.
For instance, getredirect.c
(https://curl.haxx.se/libcurl/c/getredirect.html)
However, I didn't get the desired result.
My apologies if my question is trivial or has already been answered. The
curl-library seems huge !
Could someone help ?
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-07-19