Skip to main content

Posts

Showing posts with the label Curl

How to send a payload to an HTTP server using Linux commands Curl and Wget

  Here's how to send a payload to an HTTP server using Linux commands: 1. Choose your tool: curl: More versatile, supports various HTTP methods and payload formats. wget: Simpler for basic GET requests and file downloads. 2. Construct the command: a. Using curl: Specify the HTTP method: GET: curl http://example.com POST: curl -X POST http://example.com PUT: curl -X PUT http://example.com Attach the payload: Form data: --data "param1=value1&param2=value2" Raw data: --data-binary @file.txt (Reads data from a file) JSON data: --header "Content-Type: application/json" --data '{"key": "value"}' Example (POST request with form data): Bash curl -X POST http://example.com/form \ --data "name=John&email=johndoe@example.com" b. Using wget (for simple GET requests): Bash wget http://example.com/data?param1=value1 3. Replace placeholders: http://example.com : The actual server URL