On Wed, 3 Sep 2003, wendy soros wrote: [...] > What I am trying to do is very similar to the > ABEBooks.com example in Burke (p.74): use the POST > method to submit some parameters to a form and save > the response to a local file. As done in the example, > I first got the name-value pairs of the form.
Can you see the name-value pairs that will actually carry the data of interest back to the server (don't worry about the submit part)? I mean, can you see them from the HTML::Form interface? > The > problem I have is that I don't know how to submit the > form. In the webpage, there are two buttons "Search" > and "Clear Form", but I can't find the pair of name > and value for submission. That doesn't necessarily matter. > In the source code, the two > buttons are represented by two images: > "search_gray.gif" and "clearform_gray.gif", below is > the part of the source code I guess is relavent. [...] You have JavaScript code embedded in the HTML. Luckily, it seems from what you say that the JavaScript doesn't actually generate the name/value pairs, but only does the submission. You could look at the submitForm function to see exactly what it does (it might be in a separate HTML file, referenced in a src attribute -- it will likely have a .js extension). However, you'll probably find that all that submitForm function does is to validate the form values, so you could just try submitting the form as-is after filling it in with HTML::Form. IIRC, $form->submit(); gets you an HTTP::Request, which you then use in the normal way (I forget what that is :-). As somebody here says periodically, it'd be nice if LWP could interpret JS automatically. What happened to the last guy who tried that? He reported some progress, then disappeared. I have some somewhat-working Python code to do this, if any enthusiastic Perl hacker wants to use it as a starting point (it uses a spidermonkey JS/Python bridge -- very similar to Perl's Javascript module -- to bind JS to a pure-Python level 2 HTML DOM and assorted paraphenalia). John
