简体   繁体   English

将数据从PHP发送到C#或VB.NET

[英]Send Data From PHP to C# or VB.NET

Today'm trying to pass a variable and an array of PHP to a desktop application, but I have no clue how to do it. 今天我试图将一个变量和一个PHP数组传递给桌面应用程序,但我不知道如何做到这一点。

To be more precise in my question I need PHP run the Desktop Application Developed in C # or VB.NET and send a variable. 更确切地说,在我的问题中,我需要PHP运行在C#或VB.NET中开发的桌面应用程序并发送变量。

If anyone can help me with some solution,suggestion or method is welcome Thank You. 如果有人可以帮我解决一些问题,欢迎提出建议或方法谢谢。

You should send the information to the client in a format you can parse client side. 您应该以可以解析客户端的格式将信息发送到客户端。 XML would be one example. XML就是一个例子。

So if you go the XML route (I'd look for a better transport data structure) 所以如果你走XML路线(我会寻找更好的传输数据结构)

  1. PHP outputs XML when the client application requests the data 当客户端应用程序请求数据时,PHP输出XML
  2. The client then parses the XML pulling the data from it and storing it as a native data structure 然后,客户端解析XML,从中提取数据并将其存储为本机数据结构

Given your clarification in your comment (that you want to do this on the client machine), the answer is you can't. 鉴于您在评论中的澄清(您希望在客户端计算机上执行此操作),答案是您不能。 PHP doesn't run on the clients machine, it runs on your server and outputs to the clients browser, the browser then interprets that and displays the results, the browser doesn't run other applications as that is asecurity breach...except when downloading certain mime-types. PHP不在客户端计算机上运行,​​它在您的服务器上运行并输出到客户端浏览器,然后浏览器解释并显示结果,浏览器不运行其他应用程序,因为这是一个安全漏洞...除非当下载某些mime类型。 If you are doing this with the users knowing cooperation, that might be a solution. 如果您正在与知道合作的用户进行此操作,那么这可能是一种解决方案。 If you control both code bases (the PHP and C#), then it's more likely, it would make more sense for the user to run the desktop app and for it to communicate with the PHP page to get the info it has. 如果您同时控制两个代码库(PHP和C#),那么更有可能的是,用户运行桌面应用程序并与PHP页面进行通信以获取其所拥有的信息会更有意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM