Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 17th, 2006, 8:18 PM   #1
megaskins
Newbie
 
Join Date: Feb 2006
Posts: 2
Rep Power: 0 megaskins is on a distinguished road
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.
megaskins is offline   Reply With Quote
Old Feb 18th, 2006, 12:39 AM   #2
Darkhack
Hobbyist Programmer
 
Darkhack's Avatar
 
Join Date: Dec 2005
Location: Kansas City
Posts: 105
Rep Power: 3 Darkhack is on a distinguished road
Send a message via AIM to Darkhack
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?
Darkhack is offline   Reply With Quote
Old Feb 18th, 2006, 9:26 AM   #3
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
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);
	}
}
That's some simple code to get the source from a URL. What I guess you want is some sort of HTTP proxy...

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.
Arevos is offline   Reply With Quote
Old Feb 18th, 2006, 7:58 PM   #4
megaskins
Newbie
 
Join Date: Feb 2006
Posts: 2
Rep Power: 0 megaskins is on a distinguished road
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.
megaskins is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:06 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC