简体   繁体   中英

Using server side PHP code from client side C#

I have a server side PHP script that looks like this

class MyObject {
function GetResult($input){
//some code
return $result;
}
}

I want to instantiate this object and call the GetResult function from client side c# application and get the get the result. How can i do so?

You can use Ajax call to hit on that PHP page and get the results from that PHP page. Just use JQuery Ajax function like this and make object initialization in PHP page only.

$.ajax({
      type: "POST",
      url: "example.php",
      data: {someParameter: "some value"},
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) 
      {

      }
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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