Modified
This commit is contained in:
parent
50772dedf9
commit
723858ec9b
|
@ -2,6 +2,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
@ -21,9 +23,17 @@ namespace Catswords.DataType.Client.Helper
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 원격 주소에서 XML 다운로드
|
bool isConnected = NetworkInterface.GetIsNetworkAvailable();
|
||||||
|
if (isConnected == false)
|
||||||
|
{
|
||||||
|
MessageBox.Show("인터넷에 연결되어 있지 않습니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 원격 주소에서 XML 다운로드
|
||||||
string url = Config.SEARCH_URL + q;
|
string url = Config.SEARCH_URL + q;
|
||||||
WebClient client = new WebClient();
|
WebClient client = new WebClient();
|
||||||
|
|
||||||
client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3");
|
client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3");
|
||||||
client.Encoding = Encoding.UTF8;
|
client.Encoding = Encoding.UTF8;
|
||||||
string xmlString = client.DownloadString(url);
|
string xmlString = client.DownloadString(url);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user