httpx is a Python-based HTTP client that can be used from the command line to send HTTP requests. It is useful for testing APIs, checking responses, and debugging HTTP requests. This version is installed using pip and requires a full URL with protocol.
Installation
Update Termux and install Python:
pkg update && pkg upgrade -y && pkg install python -yInstall httpx CLI using pip:
pip install "httpx[cli]"Verify installation:
httpx --helpUsage Commands
Send a GET request to a website (protocol required):
httpx https://google.comSend a GET request using HTTP:
httpx http://example.comShow response headers:
httpx https://example.com --headersSend a POST request:
httpx post https://example.com/apiSend JSON data with POST request:
httpx post https://example.com/api -j '{"name":"test"}'Set a custom User-Agent:
httpx https://example.com -H "User-Agent: Termux"Save response output to a file:
httpx https://example.com > response.txt