Would it be possible to write a proxy in C++? I mean a CLI application that would take a users input (a site name) and open Internet Explorer / FireFox to that page, bypassing network restrictions all the other fun stuff that a proxy does, much like proxy.org?

A proxy doesn't "bypass network restrictions". All it does is display another website inside of itself (or more specifically, allow a passthrough connection to another website).

And yes, it is quite possible to write a proxy in C++.

How would one go about doing such a task in C++?


EDIT: Rephrase: Would it be easy for one to complete this task? I don't want you to do it for me, that would be very stupid, seeing as I want to do this and present it as extra credit in my Computer Science class, and if you wrote it, it would be mine, now would it?

I know C++ a bit, like I can write some well developed applications, but I'm not an expert at it. What I'm truly asking is how good would someone have to be at C++ to make a proxy?

It would involve a fair bit of network programming. It can be easier or harder, depending on whether you use libraries to help ease the task of grabbing the webpages, and which one you use.

Also, C++ isn't really the best language for writing CGI scripts in my opinion, which only makes it harder, since now to write a proxy, you will need to write a parser which goes through all the external links/files, and a) downloads the external data, b) changes the HTML source so that these links point to the data in the proxy's memory.

So no, the task of grabbing HTML source from another web page and displaying it in your page isn't hard in the least (a crude PHP one could consist of no more than 1 or 2 lines), but it's the other stuff that'll trip you up. If you have no experience with writing parsers or doing network programming, then you shouldn't even attempt it.

Thank you for the information! You've helped a lot. I do have experience with writing parsers and doing network programming, so I think I'll give it a crack. Thanks again.

-- Hehe, I'd give you rep, but I've given you rep so recently that I can't (I need to "spread more rep around"). When I can, I'll add to your rep.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.