DeleteUrlCacheEntry, winhttp vs wininet - c++

Ok, guys need some advice.
I need clear web cache and I know about DeleteUrlCacheEntry, it requires wininet.h. But in my project I already use winhttp.h! If I try include wininet with winhttp, all crash!
How I can clear cache with winhttp or how I can use winhttp with wininet or what to do else?


What C++ library should I use to implement a HTTP client? [closed]

I'm looking for a C++ library that implements or enables the implementation of a HTTP client. It should handle cookies as well.
What would you propose?
Curl++: is an option, particularly if you want things in more of a C++ style.
cpp-netlib: very good and simple to use, available on ubuntu
sudo apt-get install libcppnetlib-dev
using namespace boost::network;
using namespace boost::network::http;
client::request request_("");
request_ << header("Connection", "close");
client client_;
client::response response_ = client_.get(request_);
std::string body_ = body(response_);
Take a look at Poco Libraries.
I started using them as they are portable and it's a joy to work with. Simple and clean - though I haven't dived in anything fancy for the moment.
C++ (STL) does not have a HTTP or network library by default, you will have to do with something else.
libcurl should do what you want. cURL++ is the same libcurl wrapped in a shiny C++ wrapper.
You can try WinInet
In contrast to WinHTTP, it's more client-side oriented.
If it's for windows, take a look at Windows HTTP Services (WinHTTP)
Microsoft Windows HTTP Services
(WinHTTP) provides developers with an
HTTP client application programming
interface (API) to send requests
through the HTTP protocol to other
HTTP servers.
WinHTTP offers both a C/C++
application programming interface
(API) and a Component Object Model
(COM) automation component suitable
for use in Active Server Pages (ASP)
based applications.
For Cookies
All alternative library are available here, if you need complex http APIs, try curl, if just wanna get a file, try http-tiny
On Windows you can drive IE using IWebBrowser2 interface.

wininet or winhttp, which is preferred for POST requests

I was going through the MSDN page comparing WinInet and WinHttp. Seems as though WinInet has more functionality than WinHttp. The MSDN page is here. Under what circumstances would one choose WinHttp over WinInet?
Considering that WinInet has HttpSendRequest that can be used to POST data and WinHttp also has WinHttpSendRequest. What would be the advantages of taking WinHttp over WinInet? Is there a difference in how the data is posted using WinHttp and WinInet?
In addition, if some examples of POSTing requests with both WinHttp and WinInet would help, some small sample codes.
EDIT 2 I finally managed to get a HTTP_STATUS_CODE from the app and it's 200 OK but the problem comes when sending the post data, it is sent but the parameters aren't set. I tried implementing this code on the PHP end.
$fp = fopen("data.txt", "a");
fwrite($fp, "ID = " . $_POST['id']);
the file is created as soon as the app runs but the ID parameter is not set, it writes to the file
"ID = " and no more. the 10 is not being passed through, no idea why
Thank You.
EDIT: Link to the example I tried to use.
HttpSendRequest to POST form data
Actually MSDN has a good page on WinHTTP vs. WinINet, stating:
With a few exceptions, WinINet is a superset of WinHTTP. When selecting between the two, you should use WinINet, unless you plan to run within a service or service-like process that requires impersonation and session isolation.
This example should help you out and if you are interested in WinInet example you can look in here.
Further more, a quote regarding WinInet from MSDN:
Note WinINet does not support server implementations. In addition, it should not be used from a service. For server implementations or services use Microsoft Windows HTTP Services (WinHTTP).
Which is a good advice.

Ftp library on c++ with uploading over HTTP proxy

Is anybody knows the free library for uploading over proxy with Http authentication? Maybe some url on samples how it could be.
You can use libcurl. You can see a FTP upload sample here.
For adding http proxy authentication, you will need to use options CURLOPT_PROXY, CURLOPT_PROXYPORT, CURLOPT_PROXYTYPE, CURLOPT_PROXYUSERPWD and CURLOPT_PROXYUSERNAME with curl_easy_setopt.
I might be missing something since I can't test it right now, but you can see the documentation in detail here.

HTTP Get Request in C++

I need to sent a HTTP GET Request to my site and then get the contents of the page and parse it. I'de prefer to not use libraries like libCURL because I want the end application to be fully independent (This is quoting from personal experience, I may be wrong but if I recall the client has to have certain Dynamic Link Libraries to run applications with libCURL libraries.), I'm using C++ in Visual Studio 2012.
Code examples would also be good.
When you don't want to use an external library, you will have to implement HTTP yourself. When you only need the basic functionality (direct download of a file, no redirects, no proxies, no cookies, no authentication, no encryption, no compression, no other shenanigans), this isn't even that hard.
Create a socket, connect it to port 80 of your webserver, and send the following strings to the server:
"GET /example.html HTTP/1.1\r\n"
This requests the file from the server you connected to.
The server will respond with an own HTTP response header followed by the data (or an error description).
Most libraries can be compiled statically. When you use a static library it gets linked in into your executable and you do not have to ship the library's dll. Maybe this would help: Walkthrough: Creating and Using a Static Library (C++)
Some libraries can be header-only or used in a header-only mode: compiler pulls the library into your source. Again, no dll is generated for the library. For example, you can try getting Asio and cpp-netlib to work in a header-only mode for you. There is also a sampe of a simple http client just for the Asio lying somewhere.
I think you can use WinINet or WinHTTP without shipping any DLLs.

Is there any way to read an webpage using c++

I know that we can retrieve a webpage content through curl but is there any native way to retrieve the content of an webpage using c++ without using any library?
You will always need some kind of library in order to establish a network connection (I count OS APIs as libraries). That aside, you would have to:
establish a connection to the server
send a http request
receive and handle the http response
You can implement these steps by hand, but that really is a pain, especially because http is quite a complex protocol (even if you only implement the stuff you actually use, enough remains).
If you use Windows, you can use functions below
InternetOpen() - Initializes an application's use of the WinINet functions.
InternetOpenUrl() - Opens a resource specified by a complete FTP, Gopher, or HTTP URL.
InternetReadFile() - Reads data from a handle opened by the InternetOpenUrl
InternetCloseHandle() - Closes a single Internet handle
Hope it helps
PS: or you can use a more convenient function
URLDownloadToFile() - Downloads bits from the Internet and saves them to a file.