xml - Curl -d command from the terminal -
i had specific question in regards curl. want phone call xml page , executing terminal:
curl -d @<xml page> <url>
however when execute next command, following:
invalid request construction
in xml page request follows:
<example type="request"> <dologin> <username>my_username</username> <password>my_password</password> <...other details> </dologin> </example>
how pass parameters username , password in curl command?
if want post xml
file, seek doing :
curl -d "@./file.xml" -x post -h 'content-type:text/xml' http://domain.tld/path
if instead username/password handled basic auth, seek doing using unix shell:
user=$(xmllint --xpath '/example/dologin/username/text()' file.xml) pass=$(xmllint --xpath '/example/dologin/password/text()' file.xml) curl -u "$user:$pass" http://domain.tld/path
xml
file :
<?xml version="1.0" encoding="utf-8"?> <example type="request"> <dologin> <username>my_username</username> <password>my_password</password> <...other details> </dologin> </example>
xml curl
No comments:
Post a Comment