[Greasemonkey] Post Data

Philip Friedman - Auto Europe philip at autoeurope.com
Tue May 2 08:41:28 EDT 2006


I was watching my user script with Tamper Data and saw the following
difference between the post data of a real submit (clicking a button on the
page) and on a GM_xhr POST. I don't know for sure that the server is
interpreting these differently, but it seems like this is my problem:

Real click:

   Post Data:
      Name1[]
      NameIndex[0]
      NameNumber[]
      x[52]
      y[10]

GM_xhr:

   Post Data:
      POST_DATA[Name1=&NameIndex=14&NameNumber=&x=30&y=11]

Am I "URL encoding" the post data correctly?

Here's the script code:

        GM_xmlhttpRequest( { method:'POST'
            , url:'https:www.blah.com/posthere/post.jsp?targetPage=yes.jsp'
            , data:'Name1=&NameIndex='+rtIx+'&NameNumber=&x=3&y=1'
            , ctxtIx:ctxtIx
            , cookies:cookies
            , rtIx:rtIx
            , headers:{ 'Content-type':'application/x-www-form-urlencoded'
                      , 'Host':'www.hertz.com'
                      ,
'Accept':'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,tex
t/plain;q=0.8,image/png,*/*;q=0.5'
                      , 'Accept-Language':'en-us,en;q=0.5'
                      , 'Accept-Encoding':'gzip,deflate'
                      , 'Accept-Charset':'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
                      , 'Keep-Alive':'300'
                      , 'Connection':'keep-alive'
                      ,
'Referer':'https:www.blah.com/posthere/post.jsp?targetPage=other.jsp'
                      , 'Cookie':cookies
                      , 'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT
5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.2'
                      }
            , onload: onLoadPost
        } );

I'm using GM 0.6.4 and FF 1.5.0.2 on Windows. Thanks.

--
Regards, Phil Friedman - Auto Europe


More information about the Greasemonkey mailing list