I’m trying to get wget to work with a post-request and a special password. It contains ‘ and it’s like this:
wget –save-cookie cookie.txt –post-data “user=Abraham&password=–my’precious!” http://localhost/login.php
But when I use the tick in with wget I get strange errors. Does anybody know how to get it to work?
The backtick in your request is a straightforward issue, although you may have a second one lurking in there.
The word you are looking for is ‘escape’ – the backtick has a special meaning on the commandline and you need to escape it so that it is not interpreted as such. In the bash shell (typical linux console) the escape character is
\– if you put that in front of the backtick, it will no longer get interpreted.The second potential issue is with the way you are using
wget– are you certain that is the request you are meant to send? Are you trying to authenticate with the server using a web form or with Basic, Digest or some other form of HTTP authentication?If this is the manner in which you should be authenticating, then you will also need to percent encode the
--post-dataas wget will not do this for you.