Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/239.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将数据从C#WindowsForm发布到Php并更新输入值_C#_Php_Winforms_Http_Post - Fatal编程技术网

将数据从C#WindowsForm发布到Php并更新输入值

将数据从C#WindowsForm发布到Php并更新输入值,c#,php,winforms,http,post,C#,Php,Winforms,Http,Post,我有一个C#应用程序,可以读取指纹,将其转换为字符串,并通过post将该字符串发送到php网站 我知道正在发送字符串,因为我从Web服务器获得了正确的响应,但它不会打开页面或类似的内容 我需要的是: 我有一页。当你按下白色按钮(“huella”)时,它会调用读取你指纹的C#应用程序 <a type="button" id="huella" href="fpp:" class="mb-xs mt-xs mr-xs btn btn-default">Huella</a> 有

我有一个C#应用程序,可以读取指纹,将其转换为字符串,并通过post将该字符串发送到php网站

我知道正在发送字符串,因为我从Web服务器获得了正确的响应,但它不会打开页面或类似的内容

我需要的是:

我有一页。当你按下白色按钮(“huella”)时,它会调用读取你指纹的C#应用程序

<a type="button" id="huella" href="fpp:" class="mb-xs mt-xs mr-xs btn btn-default">Huella</a>

有没有办法用响应更新调用c#app页面的输入字段值?我是新来的,在寻找解决方案方面遇到了困难。

这无法按照您的意愿完成。请尝试其他选项,例如不再是开发人员。

可能不会更新输入并与浏览器交互,但此应用程序可能会在系统的默认浏览器上打开URL。该URL可以根据需要包含查询字符串值。
    private string sendFingerprint(string fp)
    {
        try
        {
            Uri myUri = new Uri("http://localhost/demo/registrarhuella.php");
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(myUri);

            req.Method = "POST";
            string Data = "huella=" + fp;
            byte[] postBytes = Encoding.ASCII.GetBytes(Data);
            req.ContentType = "application/x-www-form-urlencoded";
            req.ContentLength = postBytes.Length;
            Stream requestStream = req.GetRequestStream();
            requestStream.Write(postBytes, 0, postBytes.Length);
            requestStream.Close();

            HttpWebResponse response = (HttpWebResponse)req.GetResponse();
            Stream resStream = response.GetResponseStream();

            var sr = new StreamReader(response.GetResponseStream());
            string responseText = sr.ReadToEnd();
            return responseText;
        }
        catch (WebException ex)
        {

            MessageBox.Show(ex.Message.ToString());
            return null;
        }
    }