I want to make a web request using WebClient but my problem is that the parameters are not being sent or [ submitted ]
code:-
private void Button1_Click(object sender, EventArgs e)
{
string URI = "http://127.0.0.1/file/function/load.php";
string myParameters = "?machinename=ncemachine&opreationsystem=Windows7&cpu=inteli3&gpu=nvidiaGTX&netframework=5.4&ram=4GB";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URI, myParameters);
}
}
load.php
<?php
$MachineName = $_GET['machinename'];
$OpreationSystem = $_GET['opreationsystem'];
$cpu = $_GET['cpu'];
$gpu = $_GET['gpu'];
$netframework = $_GET['netframework'];
$ram = $_GET['ram'];
require_once '../conf.php';
echo'test';
$dbCon = "mysql:host=$host;dbname=$db_name";
$conn = new PDO($dbCon, $username, $password);
$getquery = $conn->prepare("INSERT INTO `players` (`id`, `Pcname`, `opreationsystem`, `cpu`, `gpu`, `netframework`, `ram`) VALUES (NULL, '".$MachineName."', '".$OpreationSystem."', '".$cpu."', '".$gpu."', '".$netframework."', '".$ram."')");
$getquery->execute();
?>
the above code gives only empty rows inside the players table