UploadString POST method not working in C#

Viewed 18

I have tried to solve my problem by many ways but no success except by switching to DownloadString and sending a GET method which i don't want to do.

So I'm simply trying to upload a string variable to a simple PHP script using WebClient.UploadString method but the PHP script can't receive the script for a reason that I ignore

Here is my C# code to upload the string variable

WebClient wc = new WebClient();
string username = "John";
        
wc.UploadString("http://127.0.0.1/index/username.php", username);

And here is the PHP code to store the C# variable in $username var then in database

$username = $_POST['username'];
if(isset($username) && $username != '')
{
    $sqlqueries;
}
0 Answers
Related