如何从asp.net mvc中调用类似PHP REST服务的方法


How can i invoke methods of PHP REST-like service from asp.net mvc?

我有一个类似REST的PHP服务,我不明白如何从asp.net mvc调用该服务的功能。有人能帮忙吗?

你调查过RestSharp吗?

它使得调用RESTful API变得非常容易。他们文档中获取twitter时间线的示例:

// Create the client
var client = new RestClient();
// Set the service url
client.BaseUrl = "http://twitter.com";
// Set an optional authentication
client.Authenticator = new HttpBasicAuthenticator("username", "password");
// Create the request
var request = new RestRequest();
// The request is relative to the client base url
request.Resource = "statuses/friends_timeline.xml";
// Execute the request - the data is stored in the response.
RestResponse response = client.Execute(request);