Need a simple curl post example – how do I send data with curl? or Can someone share a basic curl pos

18 Replies, 1838 Views

Nice curl post example for JSON! For form data, here’s the deal:

- Use `-F` for multipart (files, etc.):
```bash
curl -X POST https://example.com/upload -F "username=test" -F "avatar=@image.jpg"
```

- Use `-d` for URL-encoded:
```bash
curl -X POST https://example.com/login -d "user=me&pass=123" -H "Content-Type: application/x-www-form-urlencoded"
```

If you’re stuck, `curl --verbose` shows the raw request.

Messages In This Thread



Users browsing this thread: 1 Guest(s)