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