PHP和C#交互以读取串行端口 [英] PHP and C# interaction for Reading Serial Port

查看:65
本文介绍了PHP和C#交互以读取串行端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅此存档链接

我们可以将C#与PHP一起使用来读取串口吗?

Can we use C# with PHP to read serial port similarly Or

我们是否有一个简单的解决方案,可以从PHP读取串行端口并将数据存储在数据库中.谢谢.


推荐答案

您好

Hi RakLali,

>>我们是否有一个简单的解决方案来从PHP读取串行端口并将数据存储在数据库中.

>>Do we have a simple solution to read Serial Port from PHP and store the data in database.

实际上,从C#的角度来看,使用C#读取串行端口很容易.只是基于 SerialPort类对于代码示例,您可以从

Actually, from C# point of view,  Using C# to read  serial port is easy. Just based on SerialPort Class For code sample, you can check from http://www.c-sharpcorner.com/uploadfile/eclipsed4utoo/communicating-with-serial-port-in-c-sharp/

如果使用PHP和C#交互,我建议您结束 POST请求,并将数据从c#发送到PHP脚本.

If using PHP and C# interaction, I would suggest you send POST request with data to PHP script from c#.

您可以尝试以下方法发送POST请求

You can try following to send POST request

using (var wb = new WebClient())
{
    var data = new NameValueCollection();
    data["nowa_wiadomosc"] = "TESTTTTT";


    var response = wb.UploadValues("xxxxxxxx/wiadomosci.php?", "POST", data);
}

请结帐以获取更多帮助

如何:使用WebRequest类发送数据

最诚挚的问候,

Kristin

Kristin

注意:此回复包含对第三方万维网站点的引用. Microsoft为方便您而提供此信息. Microsoft不控制这些站点,也没有测试在这些站点上找到的任何软件或信息;
因此,Microsoft无法对在此找到的任何软件或信息的质量,安全性或适用性做出任何陈述.使用在Internet上找到的任何软件都存在固有的危险,Microsoft提醒您确保 您必须完全了解从互联网上获取任何软件之前的风险.

Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites;
Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


这篇关于PHP和C#交互以读取串行端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆