I am trying to do something like CURL in jsp page. I need to check if website has some string in it. I am very bad in Java, that's why this is maybe stupid question, but it might be useful for someone else also.
Thanks a lot!
I am trying to do something like CURL in jsp page. I need to check if website has some string in it. I am very bad in Java, that's why this is maybe stupid question, but it might be useful for someone else also.
Thanks a lot!
Check HttpClient from apache...
http://hc.apache.org/httpclient-3.x/
Will do anything you may need.
Thanks!
@leo.
I would imagine for a one-off you could use Guava's Resources.readLines(URL url, Charset charset) command. If this was something you're doing on every page (:shudder:), you'd definitely want to look into apache commons' http client and use a connection pool. Though if you have a problem set that involves having to download someone else's web page before displaying your own, you're certainly going to have scaling/performance problems.
See: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/io/Resources.html