Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

How to browse from command prompt.

I want to write a program in java,
which takes aruguments, gets the output and takes some links from that.

Example:
My program should go to google.com
give some string I have and search.
once i get the output: I want to query the first 3 pages and get the data to console?

I used wget in link to get a page.
I used curl to put and get in linux.

is there easy way to do all the steps I mentioned in java
0
vkchaitu82
Asked:
vkchaitu82
  • 5
  • 4
3 Solutions
 
for_yanCommented:
YOu can use regular URLConnection and read and parse pages
or you can use HttpUnit
0
 
for_yanCommented:
This is HttpUnit which has better facility to read Web pages

http://httpunit.sourceforge.net/
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
objectsCommented:
0
 
for_yanCommented:
0
 
objectsCommented:
for more sophisticated needs use HttpClient
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/
0
 
for_yanCommented:
One of the common ways to parse is to calean HTML using or number of similar packages like
HTML Tidy - and then parse cleaned HTML using XML parsing methods
0
 
cmalakarCommented:
you may also want to look into this..

http://htmlunit.sourceforge.net/
0
 
for_yanCommented:

If you are interested in getting links form Google you may look at this site
which jsut returns just links from google
(and you can of course access  this site with all Java technology mentioned above):

http://goohackle.com/tools/google-parser/

If you want to go more into that, maybe this page about parsing google with reg expressions
may be useful. It is PHP oriented, but java also has regExp support - maybe it could be useful:

http://hackingsearch.com/2009/10/how-to-parse-google-serp-results-page-using-regular-expressions/
0
 
objectsCommented:
theres no need to parse html pages to get links from google search
theres already an api available
http://code.google.com/apis/customsearch/v1/overview.html
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now