CURL.GetRedirectURL
-------------------

Queries redirect URL.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.GetRedirectURL"; curl ) 

**MBS**( **"CURL.GetRedirectURL";** /\* Queries redirect URL. \*/  
**$curl**) /\* The CURL session handle. \*/ 

### 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](CURLSetOptionFollowLocation.md).   
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](CURLNew.md)") \]   
\# Set URL to load   
Set Variable \[ $result ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; CURL Test::URL ) \]   
\# RUN now   
Set Field \[ CURL Test::Result ; MBS ("[CURL.Perform](CURLPerform.md)"; $curl ) \]   
\# Check result   
Set Field \[ CURL Test::Text ; MBS ("[CURL.GetResultAsText](CURLGetResultAsText.md)"; $curl ; "UTF8") \]   
Set Field \[ CURL Test::newURL ; MBS ("CURL.GetRedirectURL"; $curl ) \]   
Set Field \[ CURL Test::debug ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl ) \]   
\# Cleanup   
Set Variable \[ $result ; Value: MBS ("[CURL.Release](CURLRelease.md)"; $curl ) \]  
### See also

- [CURL.GetDebugMessages](CURLGetDebugMessages.md)
- [CURL.GetRedirectCount](CURLGetRedirectCount.md)
- [CURL.GetRedirectTime](CURLGetRedirectTime.md)
- [CURL.GetResultAsText](CURLGetResultAsText.md)
- [CURL.New](CURLNew.md)
- [CURL.Perform](CURLPerform.md)
- [CURL.Release](CURLRelease.md)
- [CURL.SetOptionFollowLocation](CURLSetOptionFollowLocation.md)
- [CURL.SetOptionURL](CURLSetOptionURL.md)

### Example Databases

- [CURL/CURL Download Picture](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20Download%20Picture.shtml#1ScriptAnchor_)

This function checks for a license.

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

  
[CURL.GetRedirectTime](CURLGetRedirectTime.md) - [CURL.GetReferer](CURLGetReferer.md)

[HTML Version](CURLGetRedirectURL.shtml)