.net调用PHP函数


.net call php function

我试图从。net调用php函数。我尝试了一个webrequest方法,但我不确定如何指定在url中调用的函数。下面的链接显示了我正在尝试调用的方法。

提前感谢您的帮助

http://codex.wordpress.org/Function_Reference/wp_hash_password

首先需要在PHP服务器上创建一个网页,该网页调用所需的函数,并返回结果(理想情况下是SOAP或XML格式)。然后,您可以通过。net WebRequest机制获取该网页,正如您所指出的。

要从c#调用该函数,必须创建一个执行该函数的PHP文件,例如

http://www.somesite.com/ScriptWithTheFunction.php

内容:

<?php 
    //your includes here
    //You can set the value of $password from a $_GET parameter
    echo wp_hash_password( $password );

和c#您使用WebRequest来获得函数的输出(您从访问http://www.somesite.com/ScriptWithTheFunction.php与您的web浏览器获得相同的响应)