Hello Community,
i try to connect to a webpage with sf::Http.
First the webpage Init.php
<?php
$mysql_host = $_GET['Server'];
$mysql_user = $_GET['Username'];
$mysql_pass = $_GET['Password'];
$mysql_db = $_GET['Database'];
@mysql_connect($mysql_host, $mysql_user, $mysql_pass) OR
die ("Error: MySQL failed");
@mysql_select_db($mysql_db) OR
die ("Error: MySQL failed");
echo ("Success");
?>
Then the code in my app
sf::Http Http;
FullPHPAddress = "localhost";
FullPHPAddress = FullPHPAddress + "\\Init.php?Server=";
FullPHPAddress = FullPHPAddress + myMySQLAddress.ToString();
FullPHPAddress = FullPHPAddress + "&Username=";
FullPHPAddress = FullPHPAddress + myMySQLUsername;
FullPHPAddress = FullPHPAddress + "&Password=";
FullPHPAddress = FullPHPAddress + myMySQLPassword;
FullPHPAddress = FullPHPAddress + "&Database=Database";
Http.SetHost(FullPHPAddress);
sf::Http::Request Request;
Request.SetMethod(sf::Http::Request::Get);
Request.SetURI("/");
Request.SetBody("");
Request.SetHttpVersion(1, 0);
Request.SetField("From", "ipod.leon@googlemail.com");
sf::Http::Response Page = Http.SendRequest(Request);
if (Page.GetStatus() != 200)
{
StartErrorIndex += 1;
StartErrorIndex[StartErrorIndexState] = "Error: PHP failed!\n";
SystemOK = false;
}
if (Page.GetBody() == "Error: MySQL failed")
{
StartErrorIndex += 1;
StartErrorIndex[StartErrorIndexState] = "Error: MySQL failed!\n";
SystemOK = false;
}
When i call up the error index i get the PHp failed error!
please can anybody help me. Maybe is there an error in the get string.
Thanks for help!