2012-03-19 55 views
0

我有一個類似REST的PHP服務,我不明白如何從asp.net mvc調用此服務的功能。任何人都可以幫忙嗎?如何從asp.net mvc調用PHP REST類服務的方法?

+0

不是我今天把我的通靈帽放在家裏。穿過它!請提供一些信息,告訴我們如何在沒有任何文件的情況下爲您解決問題...... – DaveRandom 2012-03-19 16:01:46

+0

您需要什麼樣的信息?我有第三方php服務和mvc項目:)就是這樣。 – 2012-03-19 16:50:16

回答

1

你有沒有看着RestSharp?

它使調用的RESTful API的很容易。 T he example from their documentation獲取推特時間表:

// 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); 
+0

謝謝,這是我需要的。 – 2012-03-19 16:44:46