|
Hey, anyone know how to get the source code from a particular website using java? I need to get the source code from a certain site and then do stuff to it...
any help would be greatly appreciated
Replay:get source code from a website
Well if you mean java application or applet source then the only way is to ask them for it (assuming they don't supply the source on their website).
Replay:get source code from a website
If on the other hand you just need the HTML code generated by the website (You know, the code send to the browser), you could just set up a HttpConnection and read the entire page through an inputstream of some sort.
Replay:get source code from a website
yeah, sorry i mean the HTML code, thanks ractoc ill look into it
Replay:get source code from a website
he means HttpUrlConnection
setDoOutput to true (you will be reading from it, hence it is outputting to you)
then getContent will give you the page
incidentally, i found HTTPUnit MUCH better for interacting with web pages
|