![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2006
Posts: 2
Rep Power: 0
![]() |
Reading source from a browser or intercepting the HTML stream over HTTP
I need to read the source HTML of a browser page while that page is up and running and possibly rewrite that source and send it back or intercept the stream going out and change it.
I've never coded anything like this before. Any ideas on how to do this? Thanks. |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
What language are you planning to write this in? I know several languages that have functions where you simply type in the URL and they can pull the HTML source. Is that what you wanted or did you want it to only pull the HTML from pages that are being viewed by the user at that time? Also, what do you want to do with it. You said something about rewriting the source, but I don't quite understand what you want to do with the HTML once you've rewritten it. Could you be more specific?
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Since this is the Java forum, I'll hazard a guess and say he wants to program it in Java
![]() public static void main(String[] args)
throws IOException, MalformedURLException
{
URL url = new URL("http://www.monkeyengines.co.uk");
BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream())
);
while (true)
{
String line = reader.readLine();
if (line == null) {
break;
}
System.out.println(line);
}
}Have you thought of using a prewritten HTTP proxy? Some of them are pretty flexible. Here's a page that lists some java-based HTTP proxies. |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Feb 2006
Posts: 2
Rep Power: 0
![]() |
Thanks for the responses guys.
I'll write in any language that I have to use, I guess. The application I'm working on has to intercept the HTTP stream comming in and going out from a particular url. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|