Code Examples
See how to make HTTP requests in your favorite language.
- cURL
cURL is a command-line tool for making HTTP requests. It's available on most systems (Linux, macOS, Windows) and is widely used for API testing, scripting, and debugging. No installation is needed on most Unix-like systems—it's often pre-installed.
- Python
Python offers several ways to make HTTP requests. The most popular is the requests library—install with pip install requests. The standard library's urllib also works. For async code, use HTTPX.
- JavaScript
JavaScript uses the Fetch API for HTTP requests. It's built into modern browsers and Node.js (18+), and returns Promises. For older Node.js, use node-fetch or Axios.
- Ruby
Ruby can make HTTP requests with Net::HTTP from the standard library, or with gems like Faraday or HTTParty.
- Java
Java 11+ includes HttpClient in the standard library. For older versions, use libraries like OkHttp or Apache HttpClient.
- C#
C# uses HttpClient for HTTP requests. It's designed for reuse—create one instance and reuse it across requests.
- Go (Golang)
Go's net/http package provides everything needed for HTTP requests. It's simple, fast, and part of the standard library.
- PHP
PHP can make HTTP requests with cURL or the Guzzle library. cURL is built-in; Guzzle is popular for more complex needs.