Re: [Htmlparser-user] java quiz harvester
Brought to you by:
derrickoswald
From: Somik R. <so...@ya...> - 2003-01-31 17:59:20
|
I couldnt see either of the urls you sent. But, what you want to do is possible with the parser. Sending POST requests is a new feature in 1.3 (get the latest integration release). From the testcases, here's a sample (showing creation of the parser) <code> url = new URL ("http://www.canadapost.ca/tools/pcl/bin/cp_search_response-e.asp"); connection = (HttpURLConnection)url.openConnection (); connection.setRequestMethod ("POST"); connection.setRequestProperty ("Referer", "http://www.canadapost.ca/tools/pcl/bin/default-e.asp"); connection.setDoOutput (true); connection.setDoInput (true); connection.setUseCaches (false); buffer = new StringBuffer (1024); buffer.append ("app_language="); buffer.append ("english"); buffer.append ("&"); buffer.append ("app_response_start_row_number="); buffer.append ("1"); buffer.append ("&"); buffer.append ("app_response_rows_max="); buffer.append ("9"); buffer.append ("&"); buffer.append ("app_source="); buffer.append ("quick"); buffer.append ("&"); buffer.append ("query_source="); buffer.append ("q"); buffer.append ("&"); buffer.append ("name="); buffer.append ("&"); buffer.append ("postal_code="); buffer.append ("&"); buffer.append ("directory_area_name="); buffer.append ("&"); buffer.append ("delivery_mode="); buffer.append ("&"); buffer.append ("Suffix="); buffer.append ("&"); buffer.append ("street_direction="); buffer.append ("&"); buffer.append ("installation_type="); buffer.append ("&"); buffer.append ("delivery_number="); buffer.append ("&"); buffer.append ("installation_name="); buffer.append ("&"); buffer.append ("unit_numbere="); buffer.append ("&"); buffer.append ("app_state="); buffer.append ("production"); buffer.append ("&"); buffer.append ("street_number="); buffer.append (number); buffer.append ("&"); buffer.append ("street_name="); buffer.append (street); buffer.append ("&"); buffer.append ("street_type="); buffer.append (type); buffer.append ("&"); buffer.append ("test="); buffer.append ("&"); buffer.append ("city="); buffer.append (city); buffer.append ("&"); buffer.append ("prov="); buffer.append (province); buffer.append ("&"); buffer.append ("Search="); out = new PrintWriter (connection.getOutputStream ()); out.print (buffer); out.close (); parser = new HTMLParser (connection); </code> Regards, Somik __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com |