Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.1   12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3   13.4    Statistic    FMM    Blog  

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

💬 Ask a question or report a problem