curl-users
Re: Post www-urlencoded data
Date: Mon, 25 Feb 2008 12:32:06 +0100 (CET)
On Mon, 25 Feb 2008, What you get is Not what you see wrote:
Full-quoting is not cool either. You should only leave the parts of the quote
that is relevant for your reply.
>> It depends entirely on what you want to send. Since you mentioned &-separators
>> you probably don't want -F.
>
> I think my problem is either with urlencoding or a lack of knowledge on HTTP
> headers. I want to ask about the second.
I don't think the headers are any problem for you.
> I think the problem is with newline characters. Is this correct that when I
> open the @file with vi it says "incomplete last line"?
I would assume that if that 100K is a single "variable" then it most likely
shouldn't have a single newline.
> another question (if it is not the correct place to ask, forgive me) is
> about extracting _VIEWSTATE variable from html.
Well, you can easily check how the HTML is converted to a POST by using
LiveHTTPHeaders or similar.
> I see '^M' character when I open it with vi.
Within the value="" quotes? If so, you should either provide them URL-encoded
or that's some edge case where the browsers do magic stuff to figure out what
the site authors actually ment. Again, using LiveHTTPHeaders would tell you
this.
> I
> think,know that this must
> be removed. Therefore I use commands (before urlencoding) like
> tr -d "\015" < foobar > foobar2
> tr -d "\n" < foobar2 > foobar3
> tr -d "^M" <foobar3 > foobar4
> for removing newlines and ^M's from the variable.
> Is this correct?
Those command lines can work, depending on your shell and system sure, but
iirc the backslashes should either be doubled or you need to use single-quotes
on several systems/shells. Or you replace the three tr invokes with a single
sed line:
sed -i -e 's/[\r\n]//g' file
(-i being a GNU sed fancy option)
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2008-02-25