I just started C#. I want to exchange data from my remote server. I couldn’t find any code that would work for me. It would be great if you could help with code snippets. Some of my sample code is below.
My PHP Code;
<?php
include 'Connect.php';
$response = array();
if(isset($_POST['tag']) && $_POST['tag'] != '') {
$tag = $_POST['tag'];
if($tag == 'CheckUser') {
$UserName = $_POST["UserName"];
$Password = $_POST["Password"];
try {
$Check = "SELECT * FROM Users WHERE UserName=? AND Password=?";
$query = $con->prepare($Check);
$query->execute(array($UserName, $Password));
$Dataa= $query->rowCount();
if($Dataa> 0) {
$response["success"] = 1;
$response["message"] = "User Found";
}
else {
$response["success"] = 0;
$response["message"] = "User Not Found";
}
}
catch(Exception $e) {
$response["success"] = 0;
$response["message"] = $e->getMessage();
}
}
}
else {
$response["success"] = 0;
$response["message"] = "You do not have transaction authorization";
}
echo json_encode($response);
?>
How can I get the results of “success” and “message” in C#? Could you please suggest a sample code snippet?