1

I have a webpage, say at www.mypage.com, which uses $_GET to fetch data and then saves the fetched data into the MySQL database.

I need to send this HTTP Request from a Cpp File.

How can I send a HTTP Request from Cpp file?

Michael Irigoyen
  • 22,513
  • 17
  • 89
  • 131
Veer Shrivastav
  • 5,434
  • 11
  • 53
  • 83
  • If you mean "how to load html file by C/C++", then read about sockets and for example libcurl. – Eddy_Em Aug 14 '13 at 11:33
  • 1
    Are you on Linux? The easiest way is system("wget ..."). Now for the correct way you could open a socket, use a library etc.. – AlexDev Aug 14 '13 at 11:34
  • @Eddy_Em : I dont want to load a page. I just want to send some data. – Veer Shrivastav Aug 14 '13 at 11:35
  • possible duplicate of [How do you make a HTTP request with C++?](http://stackoverflow.com/questions/1011339/how-do-you-make-a-http-request-with-c) – AlexDev Aug 14 '13 at 12:51

1 Answers1

2

Yes, libcurl should be helpful. You can send some data by GET parameters or by POST and read responses. (Maybe necessary to verify a successful transmission) Here are some examples: http://curl.haxx.se/libcurl/c/example.html

XQDev
  • 366
  • 4
  • 15