Forum Moderators: coopster
I want to get page source with wget and i want to give some variable value with POST method.
with this url, the POST variable name is "example_name" and i want to apply value "testing"to it.
So in php source it would look like:
$_POST["example_name"]="testing";
But i want to know the excact command line in linux to do that operation.
something like
wget --post-data=STRING www.url.com
but with the corect syntax.
thnx
If posting two or more variables use && as a seperator (the post data is passed similarly to url encoded variable value pairs). The man file (man wget) has atleast one example of post string.
With wget in linux it is quite easy to accomplish that.
With the excact info:
wget --post-data 'example_name=testing' www.url.com
But with that method i get problems in PHP functions exec and popen.
Error comes with --post-data ' ' -- i think it gets confused because of the coates.
Allso i don't want to save it to a file with wget.
I am really interested - how to do that(-post_data) with lynx.
# Log in to the server. This can be done only once.
wget --save-cookies cookies.txt \
--post-data 'user=foo&password=bar' \
h**p://example.com/auth.php
#Now grab the page or pages we care about.
wget --load-cookies cookies.txt \
-p h**p://example.com/interesting/article.php
You can also try echoing the post string to a file and using post-file parameter to eliminate the quotes
<edit>
Also the save headers flag (-s it think though might be -h) is useful for getting a more exacting error message. I would try double quotes around "testing" if unquoted does not work...
[edited by: ergophobe at 8:04 pm (utc) on Sep. 8, 2004]
[edit reason] exemplified and delinked URLs [/edit]