Link to home
Start Free TrialLog in
Avatar of Mark40302
Mark40302

asked on

Sending/receiving vars between a C++ program and PHP file

Hello everyone,

I was wondering how to send variables inside a C++ program (running as a client) to a PHP file on a server without having an Internet browser pop up. I would like the PHP file to process the data and do something with it, like add it to a MySQL database. Does anyone know how to write a C++ program that sends some variables to a PHP file?

Also, does anyone know how to make the PHP file send something useful (like the contents of a MySQL database) back to the C++ program? I'm going to assume that my second question is more difficult.

-Mark
ASKER CERTIFIED SOLUTION
Avatar of efn
efn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark40302
Mark40302

ASKER

I looked at the site and downloaded many things, like curl-7.14.0.tar.bz2 and a binary with no SSL support that runs on Win32 (for now I just want to work with Win32). I also downloaded curlpp for a C++ wrapper. After taking a look at their competitors I downloaded http-fetcher but then realized it's only for UNIX.

I'm not sure where to start. Do you know how to make programs with curl or libcurl? Also I wasn't sure if I was going to end up using curl as an imported library, DLL, or an exe. The Win32 section of downloads only seemed to have an exe (but I could be wrong).
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry,
forget this line:          
      m_UserName.Empty();
It is from my own source code.
Thanks a lot jaime_olivares, your code worked. I set the url string to a value, changed m_pSession to pSession, deleted the last two parameters of the OpenURL function (and used their default values) since they were both causing problems, and got the program to run successfully on my first try. I accepted your code since it worked so nicely.

Also, thanks efn for the links because they informed me of a lot other free libraries I might have to use later, like zlib and OpenSSL.