Author Topic: Calling a web service  (Read 18770 times)

rpiller

  • Jr. Member
  • **
  • Posts: 90
  • Karma: 0
    • View Profile
Calling a web service
« on: July 17, 2014, 12:52:32 PM »
Are there any examples on how to call rest web services in C++? Something like: http://myurl/api/GetProduct/2 or something alike?

Also, are these forums even relevant anymore seeing as RakNet was sold and the creator seemed to be pretty much the only one answering questions here anyway :)

rpiller

  • Jr. Member
  • **
  • Posts: 90
  • Karma: 0
    • View Profile
Re: Calling a web service
« Reply #1 on: July 20, 2014, 10:44:45 AM »
Here's my code, and the result is supposed to be a record added to the DB but that doesn't happen. If I put the url in the browser it works so I know the php code is working. Just need to figure out how to do this via RakNet.

Code: [Select]
TCPInterface *tcp = RakNet::OP_NEW<TCPInterface>(__FILE__, __LINE__);

tcp->Start(0, 64);

HTTPConnection* http = RakNet::OP_NEW<HTTPConnection>(__FILE__, __LINE__);

http->Init(tcp, "localhost");

http->Update();

http->Post("/Leadwerks/gnet.php", "?opt=add&game=GvB-Rick&server=GvB.game.net");

RakString data;
data = http->Read();
http->HasBadResponse(NULL, &data);