From 11dc67702084bfc9efc56b128d4c9e0c866beea5 Mon Sep 17 00:00:00 2001 From: chicpro Date: Fri, 15 Nov 2013 15:03:34 +0900 Subject: [PATCH] =?UTF-8?q?get=5Fsock=20=EB=8C=80=EC=B2=B4=ED=95=A8?= =?UTF-8?q?=EC=88=98=20common.lib.php=20=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/config_form.php | 40 ---------------------------------------- lib/common.lib.php | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/adm/config_form.php b/adm/config_form.php index a94316e9b..cec883d30 100644 --- a/adm/config_form.php +++ b/adm/config_form.php @@ -147,46 +147,6 @@ $pg_anchor = ''; -if (!function_exists("get_sock")) { - function get_sock($url) - { - // host 와 uri 를 분리 - //if (ereg("http://([a-zA-Z0-9_\-\.]+)([^<]*)", $url, $res)) - if (preg_match("/http:\/\/([a-zA-Z0-9_\-\.]+)([^<]*)/", $url, $res)) - { - $host = $res[1]; - $get = $res[2]; - } - - // 80번 포트로 소캣접속 시도 - $fp = fsockopen ($host, 80, $errno, $errstr, 30); - if (!$fp) - { - die("$errstr ($errno)\n"); - } - else - { - fputs($fp, "GET $get HTTP/1.0\r\n"); - fputs($fp, "Host: $host\r\n"); - fputs($fp, "\r\n"); - - // header 와 content 를 분리한다. - while (trim($buffer = fgets($fp,1024)) != "") - { - $header .= $buffer; - } - while (!feof($fp)) - { - $buffer .= fgets($fp,1024); - } - } - fclose($fp); - - // content 만 return 한다. - return $buffer; - } -} - if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124'; if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295'; diff --git a/lib/common.lib.php b/lib/common.lib.php index ecf2d30f7..0233a5b4b 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -2382,4 +2382,45 @@ function get_qa_config($fld='*') return $row; } + +// get_sock 함수 대체 +if (!function_exists("get_sock")) { + function get_sock($url) + { + // host 와 uri 를 분리 + //if (ereg("http://([a-zA-Z0-9_\-\.]+)([^<]*)", $url, $res)) + if (preg_match("/http:\/\/([a-zA-Z0-9_\-\.]+)([^<]*)/", $url, $res)) + { + $host = $res[1]; + $get = $res[2]; + } + + // 80번 포트로 소캣접속 시도 + $fp = fsockopen ($host, 80, $errno, $errstr, 30); + if (!$fp) + { + die("$errstr ($errno)\n"); + } + else + { + fputs($fp, "GET $get HTTP/1.0\r\n"); + fputs($fp, "Host: $host\r\n"); + fputs($fp, "\r\n"); + + // header 와 content 를 분리한다. + while (trim($buffer = fgets($fp,1024)) != "") + { + $header .= $buffer; + } + while (!feof($fp)) + { + $buffer .= fgets($fp,1024); + } + } + fclose($fp); + + // content 만 return 한다. + return $buffer; + } +} ?> \ No newline at end of file