Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

CURL.GetRedirectURL

Queries redirect URL.

Component Version macOS Windows Linux Server iOS SDK
CURL 2.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.GetRedirectURL"; curl )   More

Parameters

Parameter Description Example
curl The CURL session handle. $curl

Result

Returns the requested value or nothing on error.

Description

Queries redirect URL.
Get the URL a redirect would take you to if you would enable CURL.SetOptionFollowLocation.
This can come very handy if you think using the built-in libcurl redirect logic isn't good enough for you but you would still prefer to avoid implementing all the magic of figuring out the new URL.

Examples

Do not follow, but return redirect URL:

# Start new session
Set Variable [ $curl ; Value: MBS("CURL.New") ]
# Set URL to load
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; CURL Test::URL) ]
# RUN now
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
# Check result
Set Field [ CURL Test::Text ; MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
Set Field [ CURL Test::newURL ; MBS("CURL.GetRedirectURL"; $curl) ]
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugMessages"; $curl) ]
# Cleanup
Set Variable [ $result ; Value: MBS("CURL.Release"; $curl) ]

See also

Example Databases

This function checks for a license.

Created 18th August 2014, last changed 21st June 2021


CURL.GetRedirectTime - CURL.GetReferer