CURL.SetOptionFollowLocation
----------------------------

Enables or disables following locations.

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

MBS( "CURL.SetOptionFollowLocation"; curl; Value ) 

**MBS**( **"CURL.SetOptionFollowLocation";** /\* Enables or disables following locations. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* Whether to follow locations  
A combination of these flags:  
1 generic follow redirects  
2 Do not use the custom method in the follow-up request if the HTTP code instructs so (301, 302, 303).  
4 Only use the custom method in the first request, always reset in the nexte.g. 1 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | Whether to follow locations   A combination of these flags:   1 generic follow redirects   2 Do not use the custom method in the follow-up request if the HTTP code instructs so (301, 302, 303).   4 Only use the custom method in the first request, always reset in the next | 1 |

### Result

Returns "OK" on success.

### Description

Enables or disables following locations.  
A parameter set to 1 tells the library to follow any Location: header that the server sends as part of an HTTP header.  
  
This means that the library will re-send the same request on the new location and follow new Location: headers all the way until no more such headers are returned. [CURL.SetOptionMaxRedirs](CURLSetOptionMaxRedirs.md) can be used to limit the number of redirects libcurl will follow.  
  
CURL can limit what protocols it will automatically follow. The accepted protocols are set with [CURL.SetOptionRedirProtocols](CURLSetOptionRedirProtocols.md) and it excludes the FILE protocol by default.  
See also [FOLLOWLOCATION](https://curl.haxx.se/libcurl/c/CURLOPT_FOLLOWLOCATION.html) option in CURL manual.

### Examples

Allow up to three redirects:

 Set Variable \[$result ; Value: MBS ("CURL.SetOptionFollowLocation"; $curl ; 1)\]  
Set Variable \[$result ; Value: MBS ("[CURL.SetOptionMaxRedirs](CURLSetOptionMaxRedirs.md)"; $curl ; 3)\]  
### See also

- [CURL.GetEffectiveURL](CURLGetEffectiveURL.md)
- [CURL.GetRedirectURL](CURLGetRedirectURL.md)
- [CURL.GetRequestSize](CURLGetRequestSize.md)
- [CURL.GetResultAsContainer](CURLGetResultAsContainer.md)
- [CURL.SetOptionMaxRedirs](CURLSetOptionMaxRedirs.md)
- [CURL.SetOptionPostRedir](CURLSetOptionPostRedir.md)
- [CURL.SetOptionRedirProtocols](CURLSetOptionRedirProtocols.md)
- [CURL.SetOptionRedirProtocolsString](CURLSetOptionRedirProtocolsString.md)
- [CURL.SetOptionUnrestrictedAuth](CURLSetOptionUnrestrictedAuth.md)
- [GMImage.Scale](GMImageScale.md)

### Example Databases

- [CURL/Amazon S3/Amazon S3 Upload File](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Amazon%20S3%20Upload%20File.shtml#3ScriptAnchor_)
- [CURL/CURL Download Picture](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20Download%20Picture.shtml#1ScriptAnchor_)
- [CURL/WebServices/AdobeSign WebService](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/AdobeSign%20WebService.shtml#17ScriptAnchor_)
- [CURL/WebServices/Twitter oAuth](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/Twitter%20oAuth.shtml#5ScriptAnchor_)

### Blog Entries

- [Translating Insert from URL options for CURL to MBS Plugin calls](https://www.mbsplugins.de/archive/2020-12-14/Translating_Insert_from_URL_op/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 2/2024, Seite 18](https://filemaker-magazin.de/neuigkeit/4257-Appetithappen-FMM_202402)

Created 18th August 2014 , last changed 13th April 2025

  
[CURL.SetOptionFileTime](CURLSetOptionFileTime.md) - [CURL.SetOptionForbidReuse](CURLSetOptionForbidReuse.md)

[HTML Version](CURLSetOptionFollowLocation.shtml)