curl
CURL error “URL using bad/illegal format or missing URL” when trying to pass variable as a part of URL
Set IFS=$’ \t\r\n’ at the top of your script. IFS is the Interactive Field Separator. In UNIX, IFS is space, tab, newline, or $’ \t\n’, but on Windows this needs to be $’ \t\r\n’. The ^M character is \r.
How do I POST form data with UTF-8 encoding by using curl?
You CAN use UTF-8 in the POST request, all you need is to specify the charset in your request. You should use this request: curl -X POST -H “Content-Type: application/x-www-form-urlencoded; charset=utf-8” –data-ascii “content=derinhält&date=asdf” http://myserverurl.com/api/v1/somemethod
Sending json files in curl requests with absolute or relative paths
The -d @ command option accepts any resolvable file path, as long as the path actually exists. So you could use: a path relative to the current directory a fully qualified path a path with soft-links in it and so on To wit, just the same as hundreds of other *Nix style commands. One quick … Read more
Forcing cURL to get a password from the environment
This bash solution appears to best fit my needs. It’s decently secure, portable, and fast. #!/bin/bash SRV=”example.com” URL=”https://$SRV/path” curl –netrc-file <(cat <<<“machine $SRV login $USER password $PASSWORD”) “$URL” This uses process substitution (<( command ) runs command in a sub-shell to populate a file descriptor to be handed as a “file” to the parent command, … Read more
How can I suppress the headers from CLI CURL’s output of request
Simply remove the -i switch from your curl command. man curl said : -i, –include (HTTP) Include the HTTP-header in the output. The HTTP-header includes things like server-name, date of the document, HTTP-version and more…
How to get webcontent that is loaded by JavaScript using cURL?
cURL will only get you the markup of the page. It won’t load any additional resources or process the page. You probably want to look at something like PhantomJS for this. PhantomJS is a headless WebKit browser. It has its own API that lets you “script” behavior. So you can tell PhantomJS to load the … Read more