In my previous battle against Internet Explorer add-on (BHO), I discovered some valuable (and scarce) resources to my aid. Pete‘s TinyBHO and CPeteHttpRequest probably saved the most of my day.
Then I realized a problem: for the browser add-on that I was writing, I would have to fetch a Web page from a server that requires user login. Under typical usage scenarios, the users are assumed to have logged in the server in a previous session, so the Web server will authorize the user from cookies. However, using WinHttp
on which CPeteHttpRequest
is based on, there seems to be no (simple) ways to obtain the user’s cookies and embed it in the HTTP request. I couldn’t find another piece that is as simplistic as CPeteHttpRequest
and also able to deal with my problem at hand.
So I wrote one myself.
K2HttpRequest
has the usage of:
K2HttpRequest request;
// Synchronous wstring innerHTML = request.request ( L"http://www.google.com" );
// Asynchronous
void foo ( wstring innerHTML ){}
request.SetOnComplete ( foo );
request.request ( L"http://www.google.com", true );
K2HttpRequest
uses IWebBrowser2
internally, which means it opens a new Internet Explorer instance under the hood and loads the Web page with it. Thus, the server will receive login cookies as if the user visited the Web page. It will fetch the Web page at the specified URL and return the HTML in the <body>
element (I actually intended return the whole <html>
element but I can’t find an easy way to do it, as IHTMLDocument2
doesn’t have get_innerHTML()
)
This is still a very preliminary version, and will probably improve as my COM/ATL skills improve some day.
Download K2HttpRequest(source code ~5KB, Visual C++ 2008)
(Update: The asynchronous part of this doesn’t work very well. I didn’t know COM enough to use Marshalling when I wrote this version. I’ll probably update this some day. If you want to get the asynchrounous part working, you’ll probably have to add in marshalling yourself :p)
reliable canadian pharmacy
fda approved pharmacies in canada
canadian pharmacy for sildenafil
discount prescription drugs online
best canadian mail order pharmacies
meds canadian compounding pharmacy
online prescriptions without a doctor
canadian prescription drugstore
non perscription on line pharmacies
online pharmacies canada reviews
top rated canadian pharmacies online
http://indianpharmacy.pro/# top online pharmacy india
https://indianpharmacy.pro/# indianpharmacy com
http://indianpharmacy.pro/# online shopping pharmacy india
http://pharmst.pro/# modafinil online pharmacy
medicine from canada with no prescriptions – meds without a doctor s prescription canada canada pharmacies
safe canadian pharmacies online – drugs without a doctor s prescription canadian trust pharmacy
top rated online pharmacies – drugs without a doctor s prescription reputable canadian mail order pharmacies
world pharmacy – international pharmacies that ship to the usa aarp approved canadian online pharmacies
non perscription online pharmacies – meds without a doctor s prescription canada best canadian prescription prices
http://cialiswithoutprescription.pro/# canadian pharmacy online cialis
https://pharmacyindia.pro/# buy prescription drugs from india
https://cialiswithoutprescription.pro/# cialis without a prescription paypal
With havin so much content and articles do you ever run into any problems of plagorism or copyright infringement? My site has a lot of completely unique content I’ve either created myself or outsourced but it looks like a lot of it is popping it up all over the web without my authorization. Do you know any ways to help reduce content from being ripped off? I’d certainly appreciate it.
https://canadiandrugs.pro/# canadian pharmacy no rx needed
http://cialiswithoutprescription.pro/# cialis legal purchase
https://prednisonepills.pro/# prednisone price canada
https://cytotecpills.pro/# buy cytotec pills
https://ciproantibiotic.pro/# buy cipro online
over the counter erectile dysfunction pills: cheap erectile dysfunction pills – ed pills that work