Hi,
On Monday, 3. March 2008, sebb wrote:
> On 03/03/2008, Tom Fernandes <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > On Monday, 3. March 2008, sebb wrote:
> > > On 03/03/2008, Tom Fernandes <[EMAIL PROTECTED]> wrote:
> > > > Hi all,
> > > >
> > > > is it possible to turn a GET string into a POST? We have dynamic
> > > > forms and extracting names and values with the Regex Extractor has
> > > > been quite tricky.
> > > >
> > > > Now we will insert a GET string as a comment into the page-source
> > > > our application which we will use make the POST HTTP Request.
> > > >
> > > > the GET string will look like the following:
> > > >
> > > >
> > > > /foo/bar/bookFood.php?fork=&spoon=2&arrival=walking&flightnumber=&ai
> > > >rline =
> > > >
> > > > I don't know on forehand how many name-value-pairs the form will
> > > > have - so the easiest to me seems to "just" POST this URL (e.g. use
> > > > HTTP Request, set Method to POST and insert this URL into the Path
> > > > field). Is this possible?
> > >
> > > Depends on the application. It may work.
> > >
> > > > My other option would be to use the Regex Extractor on the GET
> > > > string where the field Regular Expression is:
> > > >
> > > > (?:.*?)\?(.*?)=(.*?)&(.*?)=(.*?)&(.*?)=(.*?)&(.*?)=(.*?)&
> > > >
> > > > Template would be: $1$$2$$3$$4$ and so on
> > > >
> > > > and have a HTTP Request (set to POST) where I insert our maximum
> > > > Number of name-value pairs via MYREF_g1, MYREF_g2, MYREF_g3, etc.
> > > > into the "Send Parameters with the Request" fields.
> > >
> > > This is much what I suggested earlier in another thread, except that I
> > > would use set the match number to -1, and use the variables:
> > >
> > > MYREF_1_g1 MYREF_1_g2
> > > MYREF_2_g1 MYREF_2_g2
> > > etc
> > > as the Name & Value
> >
> > Will I have to set anything in the the Template field of the Regex
> > Extractor?
>
> No.
>
> > I also don't seem to find an appropriate regular expression (for my
> > example above) to match the name or the value in the GET string more than
> > once.
>
> The basic pattern is
>
> name=value
>
> The difficulty is knowing where the name and particularly the value end.
>
> The name is probably only alphanumeric.
> The value may be more varied, if not you could try
>
> (\w)+=(\w+)
okay that seems to work so far.
As I don't know the amount of name=value pairs I've added 8 lines to "Send
Parameters with the Request". Now - if only 4 are there I will get the
variable names like ${FOO_5_g1}=${FOO_5_g2} in the POST - how can I suppress
those?
Tom
>
> > Will I have to use the foreach controller for this?
>
> No
>
> > thanks,
> >
> >
> > Tom
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]