I'm trying to send a POST request to my site, then the site saves that info in a file. The problem is that it apparently isn't receiving the fields I set.
C++ Program:
#include <iostream>
#include <string>
#include <SFML/Network.hpp>
int main()
{
sf::Http http;
sf::Http::Request req;
req.SetMethod(sf::Http::Request::Post);
req.SetUri("/GetRequest.php");
req.SetField("firstname", "aus");
req.SetField("last", "tech");
http.SetHost("http://theaustech.110mb.com");
http.SendRequest(req);
}
GetRequest.php
<?php
$name = $_POST["firstname"];
$lastname = $_POST["last"];
$list = fopen("savename.txt", 'a');
fwrite($list, $name);
fwrite($list, " ");
fwrite($list, $lastname);
fwrite($list, "\n");
fclose($list);
?>
The request is getting sent though, because every time I run this program, I check the savename.txt file and there's a new line added. So that means that the name nor the lastname field is being grabbed since it's outputting nothing but the new line.
Does anyone know what I did wrong? Or how I can go about fixing it?