I am trying to use mechan开发者_JAVA技巧ize to scrape a webpage but I found out that some pages are not reachable by URL but by changing a session variable to a certain value, so how can I set a session variable in Mechanize or keep the session state ?
At a minimum, I'd say these URL's require the Session Cookie to be sent along in the Request. The server will send this in the Response once you hit the site for the first time (per client/browser instance etc.)
Additionally, these URL's require the person to be logged in, so you will have to ensure you simulate these login steps first, and subsequently, once authenticated, send the Session Cookie along.
There must be an option in Mechanize to read session cookies and send them to the server on subsequent URL requests.
精彩评论