I have arm-based busybox (Embedded Linux) with limited binaries. How to http post or put without using curl?
DESCRIPTION. curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, GOPHER, DICT, TELNET, LDAP or FILE).
Curl is bundled with PHP, HTTPRequest is a separate PECL extension. As such, it's much more likely that CURL will be installed on your target platform, which is pretty much the deciding factor for most projects.
When the -F option is used, curl sends the data using the multipart/form-data Content-Type. Another way to make a POST request is to use the -d option. This causes curl to send the data using the application/x-www-form-urlencoded Content-Type.
curl knows the HTTP method If you just pass in a HTTP URL like curl http://example.com , curl will use GET. If you use -d or -F curl will use POST, -I will cause a HEAD and -T will make it a PUT.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With