Reputation: 3606
I have arm-based busybox (Embedded Linux) with limited binaries. How to http post or put without using curl?
Upvotes: 31
Views: 57618
Reputation: 1132
Use wget --post-data "xxx" -q $URL
to make a POST request to URL with xxx
as the post data.
Upvotes: 4
Reputation: 121
i just have the same problem as you so i decided to create minimum image from alpine that do lot more than busy box and less than ubuntu https://hub.docker.com/r/prima101112/palugada
you could do curl traceroute or even vim to edit inside pods or container
or if you want to still go with busybox usually i will go
kubectl exec -it busybox -- wget {url}
kubectl exec -it busybox -- cat index.html
that command will show the response
hope this will help
Upvotes: 5
Reputation: 1174
busybox
has wget
but this limited and unsuitable for posting.
You can combine busybox
with netcat
(or nc
) for achieving the result. You only need to download netcat
binaries for your platform. And here we go:
POST_PATH="/login.cgi"
HOST=199.188.1.99
BODY="Put here HTML body...."
BODY_LEN=$( echo -n "${BODY}" | wc -c )
echo -ne "POST ${POST_PATH} HTTP/1.0\r\nHost: ${HOST}\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: ${BODY_LEN}\r\n\r\n${BODY}" | \
nc -i 3 ${HOST} 80
Based on Sending HTTP POST request with netcat post.
Upvotes: 23