Re: Using wget to fill in a form
On Sat, 22 Sep 2012 10:01:51 -0500, craig wrote:
> Greetings,
>
> I have a small book collection (~150) that I thought would be neat to
> catalog by the Library of Congress catalog numbers. I have found a LOC
> search form that will allow me to input the ISBN, and it will return the
> information I want:
>
> [code]http://www.loc.gov/cgi-bin/zgate?ACTION=INIT&FORM_HOST_PORT=/prod/www/data/z3950/locils2.html,z3950.loc.gov,7090[/code]
>
> I have the list of book ISBNs in a text file, so scripting this should
> be quite easy. The problem is I can't figure out how to submit the form
> from the command line. I figured wget would be the best way, but
> everything I try results in downloading a single line that reads "Your
> form didn't include an ACTION!" So I thought I would turn to here for
> help. The test ISBN I am using is for The Linux Cookbook: 1886411484,
> QA76.76.O63S788 2001.
As others suggest, the query should be something like:
wget http://www.loc.gov/cgi-bin/zgate --post-data="ACTION=SEARCH&TERM_1=1886411484&SESSION_ID=1234567"
But I get "session expired" :-(
(note the "SESSION_ID" field value is completely arbitrary in the above line)
> And a related side question. From my reading, I've learned that the
> Z39.50 protocol is used to query databases, usually library related. Is
> anyone aware of an ISBN database table that can be downloaded by the
> user, preferably in a format that can be imported into MySQL or
> PostgreSQL?
Well, according to this:
http://www.loc.gov/z3950/gateway.html#about
You can query the database by means of Z39.50 client, should you find one ;-)
Greteings,
--
Camaleón
Reply to: