-1
我需要從https://developer.companieshouse.gov.uk/api/打英國Companies House API。如何在MVC4中使用Companyhouse API#C#
在它的網站上有一個使用CURL的好例子,因爲我在C#MVC中進行編程,需要實現公司搜索功能,它將使用此API獲取數據。
我需要從https://developer.companieshouse.gov.uk/api/打英國Companies House API。如何在MVC4中使用Companyhouse API#C#
在它的網站上有一個使用CURL的好例子,因爲我在C#MVC中進行編程,需要實現公司搜索功能,它將使用此API獲取數據。
根據this Stack Overflow post。 Curl示例(https://api.companieshouse.gov.uk/search/companies
)的C#等效項可能如下所示:
using System.Net;
using System.IO;
string url = "GET https://api.companieshouse.gov.uk/search/companies";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Credentials = // here you have to set your authentication data
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();