Execute cURL Request
curl_executeExecute HTTP requests using structured cURL parameters to handle URL encoding, headers, authentication, and response processing automatically.
Instructions
Execute an HTTP request using cURL with structured parameters.
This tool provides a safe, structured way to make HTTP requests with common cURL options. It handles URL encoding, header formatting, and response processing automatically.
Args:
url (string, required): The URL to request
method (string): HTTP method - GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
headers (object): HTTP headers as key-value pairs
data (string): Request body for POST/PUT/PATCH requests
form (object): Form data as key-value pairs (multipart/form-data)
follow_redirects (boolean): Follow HTTP redirects (default: true)
max_redirects (number): Maximum redirects to follow (0-50)
insecure (boolean): Skip SSL verification (default: false)
timeout (number): Request timeout in seconds (1-300, default: 30)
user_agent (string): Custom User-Agent header
basic_auth (string): Basic auth as "username:password"
bearer_token (string): Bearer token for Authorization header
verbose (boolean): Include verbose request/response details
include_headers (boolean): Include response headers in output
compressed (boolean): Request compressed response (default: true)
include_metadata (boolean): Wrap response in JSON with metadata
Returns: The HTTP response body, or JSON with metadata if include_metadata is true: { "success": boolean, "exit_code": number, "response": string, "stderr": string (if present) }
Examples:
Simple GET: { "url": "https://api.example.com/data" }
POST JSON: { "url": "https://api.example.com/users", "method": "POST", "headers": {"Content-Type": "application/json"}, "data": "{"name": "John"}" }
With auth: { "url": "https://api.example.com/secure", "bearer_token": "your-token-here" }
Error Handling:
Returns error message if cURL fails or times out
Exit code 0 indicates success
Non-zero exit codes indicate various cURL errors
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL to request | |
| method | No | HTTP method (defaults to GET, or POST if data is provided) | |
| headers | No | HTTP headers as key-value pairs (e.g., {"Content-Type": "application/json"}) | |
| data | No | Request body data (for POST/PUT/PATCH). Use JSON string for JSON payloads | |
| form | No | Form data as key-value pairs (uses multipart/form-data) | |
| follow_redirects | No | Follow HTTP redirects (default: true) | |
| max_redirects | No | Maximum number of redirects to follow | |
| insecure | No | Skip SSL certificate verification (default: false) | |
| timeout | No | Request timeout in seconds (default: 30, max: 300) | |
| user_agent | No | Custom User-Agent header | |
| basic_auth | No | Basic authentication in format 'username:password' | |
| bearer_token | No | Bearer token for Authorization header | |
| verbose | No | Include verbose output with request/response details | |
| include_headers | No | Include response headers in output | |
| compressed | No | Request compressed response and automatically decompress | |
| include_metadata | No | Wrap response in JSON with metadata (exit code, success status) |