DWTD
CS 0101 , CS 0111 error[Solved]
// C# 샘플 코드
using System;
using System.Net;
using System.Net.Http;
using System.IO;
namespace ConsoleApp1
{
class Program
{
static HttpClient client = new HttpClient();
public static HttpClient Client { get => Client1; set => Client1 = value; }
public static HttpClient Client1 { get => Client3; set => Client3 = value; }
public static HttpClient Client2 { get => Client3; set => Client3 = value; }
public static HttpClient Client3 { get => client; set => client = value; }
static void Main(string[] args)
{
string url = "http://apis.data.go.kr/1360000/EqkInfoService/getEqkMsg"; // URL
url += "?ServiceKey=" + "[API KEY}"; // Service Key
url += "&pageNo=1";
url += "&numOfRows=10";
url += "&dataType=XML";
url += "&fromTmFc=20171101";
url += "&toTmFc=20171129";
var request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
string results = string.Empty;
HttpWebResponse response;
using (response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
results = reader.ReadToEnd();
}
Console.WriteLine(results);
}
}
}
21 replies