I'm trying to send a C # data to PHP, but the example I find and all the solutions simply result in the same error.
using System.Net;
using System.Collections.Specialized;
string valor = "1";
string urlAddress = "http://localhost:80/Untitled-1.php";
using (WebClient client = new WebClient())
{
NameValueCollection postData = new NameValueCollection()
{
{ "valor", valor}
};
client.UploadValues(urlAddress, postData);
}
PHP code to receive data:
<html>
<?php
$valor = $_POST["valor"];
echo $valor;
?>
Error in PHP:
Notice: Undefined index: value in C: \ xampp \ htdocs \ Untitled-1.php on line 4
It's a very simple code, but it's the basis of a larger program. Anyone have any idea what it can be?