views:

45

answers:

2

i have some parsed data in two files. i need to send these to a webserver of a website. i also need to be logged into the webserver first. i am new to this web interaction thing. i just need to know how might i go about doing this. i am learning the libcurl library so i guess it can send standard HTTP POST messages. i will make a simple webserver to test it myself. can anyone tell me what kind of interaction is needed. by that i mean how do i send the username and password information, know that i am logged in and then be send the files. may be some examples of Form Posts which i believe is what i shud be doing right now.

A: 

Depending on the type of authentication being performed, the libcurl library may have functionality already built into it to support what you are trying to do. Check out the curl_easy_setopt function--specifically the section dealing with authentication.

For basic authentication, you can do the following.

curl_easy_setopt( curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_easy_setopt( curl, CURLOPT_USERPWD, "username:password" );
Matthew T. Staebler
A: 

You can use for example an old Wininet.dll (http://msdn.microsoft.com/en-us/library/aa385473%28VS.85%29.aspx) or more recent Winhttp.dll on the client side. The last one (WinHTTP) has two C/C++ API and COM Interface. Moreover, in WinHTTP you have more Authentication options (http://msdn.microsoft.com/en-us/library/aa383144%28VS.85%29.aspx).

On the other side old Wininet.dll has function like InternetWriteFile. In InternetConnect (Wininet.dll) you can give lpszUsername and lpszPassword.

In WinHTTP you should use WinHttpSetOption and WinHttpSetCredentials to give Username and password.

Search for both Wininet and WinHTTP and you will find enough Information to decide which one is better for your requirements.

Oleg