cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Post www-urlencoded data

From: What you get is Not what you see <wyginwys_at_gmail.com>
Date: Mon, 25 Feb 2008 13:15:54 +0200

On Mon, Feb 25, 2008 at 11:51 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 25 Feb 2008, What you get is Not what you see wrote:
>
> Please don't top-post, it makes it very hard to follow this thread in mail and
> in the web archives.
>
>
> > I am not sure if curl is sending what i expect because I use --data @file
> > option and I am confused with the format of it. Also I dont know how to
> > check if curl sends the correct data if it is different than the --trace
> > option.
>
> --trace and --trace-ascii should help you see exactly what curl sends as then
> you can verify that it matches what you expected it to send.
>
>
> > Now I use --data @file option and some headers and a cookie jar to post a
> > form's data. The file's structure is like that
> > prm1=urlencodeddata&prm2=urlencodeddata... this file has no newline
> > characters. I suppose curl puts correct Content-type, content-length headers
> > when posts.
>
> Yes it does. If curl sends the wrong data, I can only assume that you did the
> URL encoding wrong, possibly by encoding the &-separators too or similar.
> Also, --data-binary might be more suitable for you.
>
>
> > I overlooked -F option. There is no submit buttons on the form.
>
> -F has no particular relation to a submit button or not.
>
>
> > Instead the post is done by javascript in a custom ASP.Net's way.
>
> Neither does it matter if the post is done by javascript when a browser does
> this.
>
>
> > Should I use -F option?
>
> It depends entirely on what you want to send. Since you mentioned &-separators
> you probably don't want -F.
>
>
>
> --
> Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
>

I think my problem is either with urlencoding or a lack of knowledge
on HTTP headers.
I want to ask about the second.
I think the problem is with newline characters.
Is this correct that when I open the @file with vi it says "incomplete
last line"?
another question (if it is not the correct place to ask, forgive me)
is about extracting _VIEWSTATE
variable from html. I see '^M' character when I open it with vi. 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?
I am determined to solve this problem and keep on struggling.
Received on 2008-02-25