如何从php访问c#代码 [英] how to access c# code from php

查看:94
本文介绍了如何从php访问c#代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个php网站和一个智能卡,智能卡的实现是在C#中,即从智能卡和卡插入或删除处理程序读取和写入文件。现在我必须执行c#代码并在php网站上显示数据,我还必须从php写回智能卡上的数据。 andy一个人知道合适的方式来交互php和c#

i have a php website and a smartcard, the implementation with smartcard is in C# i.e reading and writing files from smartcard and card insertion or removal handler. now i have to execute c# code and show the data on php website and i also have to write back data on smartcard from php. andy one know suitable way to interact php and c#

推荐答案

智能卡的实现是在C#中,即从智能卡和卡插入或删除处理程序读取和写入文件 - >从我在这里看到的是智能卡将在某些设备上联系/交换日期(卡插入/移除处理程序)。



您需要在卡插入/删除处理程序上实现中间人才能与PHP网站连接/交换数据。从c#开始,您可以为PHP站点创建一些Web请求。



这里有一些示例:

the implementation with smartcard is in C# i.e reading and writing files from smartcard and card insertion or removal handler -> From what I can see here is the smartcard will contact / exchange date on some devices (card insertion / removal handler).

You need to implement on card insertion / removal handler as middle man in order to connect / exchange data with your PHP website. From c# you can create some web request to your PHP site.

some example here :
//Create request from your card insertion / removal handler to your PHP site
WebRequest objRequest = HttpWebRequest.Create("https://targetwebsitephp.com");
objRequest.Credentials = CredentialCache.DefaultNetworkCredentials;
objRequest.Proxy = WebRequest.DefaultWebProxy;
objRequest.Proxy.Credentials = CredentialCache.DefaultCredentials;
objRequest.UseDefaultCredentials = true;

WebResponse objResponse = (WebResponse)objRequest.GetResponse();

using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
    string str = sr.ReadToEnd();
    sr.Close();
    //... Do stuff with str
}





也许你可以给我们更多关于你的信息使用您的系统进行规划。



Maybe you can give us more info regarding your planning with your system.


这篇关于如何从php访问c#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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