Hello all,<br><br>I&#39;ve been trying to send POST data to this library database with Python&#39;s urllib, but I can&#39;t get it to work.<br><br>The website is <a href="http://catalog.denverlibrary.org/cgi-bin/cw_cgi?getLimitedTerms+2307">http://catalog.denverlibrary.org/cgi-bin/cw_cgi?getLimitedTerms+2307</a> (although the session expires after a short period of time. So it&#39;s better to first go to <a href="http://denverlibrary.org">denverlibrary.org</a> and then navigate to the advanced search page).<br>
<br>This is the script that I used:<br><br>###################################################################<br>import urllib<br><br>queryString = &quot;database=10&amp;search1=%2F%2Fw&amp;terms1=&amp;bool1=and&amp;search2=%2F%2Fn&amp;terms2=&amp;bool2=and&amp;search3=%2F%2Ftw%2F&amp;terms3=nanking&amp;bool3=and&amp;search4=%2F%2Fsd%2F&amp;terms4=&amp;bool4=and&amp;search5=%2F%2Fed%2F&amp;terms5=&amp;spellcheck=false&amp;keywords1=qdvds&amp;keywords2=--none--&amp;datelimit=%3E&amp;year1=&amp;year2=&amp;limiter_count=3&amp;branch=&amp;Search=Search&amp;Available=yes&quot;<br>
<br>url = &quot;<a href="http://catalog.denverlibrary.org/cgi-bin/cw_cgi?customSearchFinish+17410">http://catalog.denverlibrary.org/cgi-bin/cw_cgi?customSearchFinish+17410</a>&quot;<br><br>print urllib.urlopen(url, queryString).read()<br>
###################################################################<br><br>However, whenever I run the script I receive the page I was on (Advanced Search page) again. I&#39;d like to get the page with the search results. This is what I got from livehttpheaders when I initiated a search from the website:<br>
<br>###################################################################<br><a href="http://catalog.denverlibrary.org/cgi-bin/cw_cgi?customSearchFinish+17410">http://catalog.denverlibrary.org/cgi-bin/cw_cgi?customSearchFinish+17410</a><br>
<br>POST /cgi-bin/cw_cgi?customSearchFinish+17410 HTTP/1.1<br>Host: <a href="http://catalog.denverlibrary.org">catalog.denverlibrary.org</a><br>User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5<br>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<br>Accept-Language: en-us,en;q=0.5<br>Accept-Encoding: gzip,deflate<br>Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br>Keep-Alive: 300<br>Connection: keep-alive<br>
Referer: <a href="http://catalog.denverlibrary.org/cgi-bin/cw_cgi?getLimitedTerms+17410">http://catalog.denverlibrary.org/cgi-bin/cw_cgi?getLimitedTerms+17410</a><br>Cookie: __utma=109436176.390208191.1209600128.1209671991.1209676393.6; __utmz=109436176.1209600128.1.1.utmccn=(referral)|utmcsr=<a href="http://catalog.denverlibrary.org">catalog.denverlibrary.org</a>|utmcct=/cgi-bin/cw_cgi|utmcmd=referral; __utma=125080728.808666458.1209606982.1209606982.1209606982.1; __utmz=125080728.1209606982.1.1.utmccn=(referral)|utmcsr=<a href="http://denverlibrary.org">denverlibrary.org</a>|utmcct=/catalogs/index.html|utmcmd=referral; __utmc=109436176; __utmb=109436176<br>
Content-Type: application/x-www-form-urlencoded<br>Content-Length: 322<br>database=10&amp;search1=%2F%2Fw&amp;terms1=&amp;bool1=and&amp;search2=%2F%2Fn&amp;terms2=&amp;bool2=and&amp;search3=%2F%2Ftw%2F&amp;terms3=nanking&amp;bool3=and&amp;search4=%2F%2Fsd%2F&amp;terms4=&amp;bool4=and&amp;search5=%2F%2Fed%2F&amp;terms5=&amp;spellcheck=false&amp;keywords1=qdvds&amp;keywords2=--none--&amp;datelimit=%3E&amp;year1=&amp;year2=&amp;limiter_count=3&amp;branch=&amp;Search=Search&amp;Available=yes<br>
<br>HTTP/1.x 302 Found<br>Date: Thu, 01 May 2008 21:13:54 GMT<br>Server: Apache/2.2.0 (Unix) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8b PHP/5.1.6 JRun/4.0<br>Location: <a href="http://catalog.denverlibrary.org:80/cgi-bin/cw_cgi?resultsScreen+17410+1+1+0">http://catalog.denverlibrary.org:80/cgi-bin/cw_cgi?resultsScreen+17410+1+1+0</a><br>
Content-Length: 260<br>Keep-Alive: timeout=5, max=100<br>Connection: Keep-Alive<br>Content-Type: text/html; charset=iso-8859-1<br>###################################################################<br><br>I&#39;d appreciate any suggestions. Thanks!<br>