CURL.SetOptionMaxRedirs
-----------------------

Sets the redirection limit.

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

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

**MBS**( **"CURL.SetOptionMaxRedirs";** /\* Sets the redirection limit. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* Maximum number of redirects.e.g. -1 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | Maximum number of redirects. | -1 |

### Result

Returns "OK" on success.

### Description

Sets the redirection limit.  
If that many redirections have been followed, the next redirect will cause an error (CURLE\_TOO\_MANY\_REDIRECTS). This option only makes sense if the [CURL.SetOptionFollowLocation](CURLSetOptionFollowLocation.md) is used at the same time. Added in 7.15.1: Setting the limit to 0 will make CURL refuse any redirect. Set it to -1 for an infinite number of redirects (which is the default)  
See also [MAXREDIRS](https://curl.haxx.se/libcurl/c/CURLOPT_MAXREDIRS.html) option in CURL manual.

### Examples

Allow up to three redirects:

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

- [CURL.GetEffectiveURL](CURLGetEffectiveURL.md)
- [CURL.GetResultAsContainer](CURLGetResultAsContainer.md)
- [CURL.SetOptionFollowLocation](CURLSetOptionFollowLocation.md)
- [CURL.SetOptionMaxAgeConn](CURLSetOptionMaxAgeConn.md)
- [CURL.SetOptionMaxFileSize](CURLSetOptionMaxFileSize.md)
- [CURL.SetOptionPostRedir](CURLSetOptionPostRedir.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/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_)

Created 18th August 2014 , last changed 12nd May 2016

  
[CURL.SetOptionMaxRecvSpeed](CURLSetOptionMaxRecvSpeed.md) - [CURL.SetOptionMaxSendSpeed](CURLSetOptionMaxSendSpeed.md)

[HTML Version](CURLSetOptionMaxRedirs.shtml)