function http_request($url, $method = 'GET', $headers = '', $post = array())
 {
     $use_proxy = PukiWikiConfig::getParam('use_proxy');
     $proxy_host = PukiWikiConfig::getParam('proxy_host');
     $proxy_port = PukiWikiConfig::getParam('proxy_port');
     $rc = array();
     $arr = parse_url($url);
     $via_proxy = $use_proxy and PukiWikiFunc::via_proxy($arr['host']);
     // query
     $arr['query'] = isset($arr['query']) ? '?' . $arr['query'] : '';
     // port
     $arr['port'] = isset($arr['port']) ? $arr['port'] : 80;
     $url = $via_proxy ? $arr['scheme'] . '://' . $arr['host'] . ':' . $arr['port'] : '';
     $url .= $arr['path'] ? $arr['path'] : '/';
     $url .= $arr['query'];
     $query = $method . ' ' . $url . " HTTP/1.0\r\n";
     $query .= "Host: " . $arr['host'] . "\r\n";
     $query .= "User-Agent: modPukiWiki/0.1\r\n";
     // Basic 認証用
     if (isset($arr['user']) and isset($arr['pass'])) {
         $query .= 'Authorization: Basic ' . base64_encode($arr['user'] . ':' . $arr['pass']) . "\r\n";
     }
     $query .= $headers;
     // POST 時は、urlencode したデータとする
     if (strtoupper($method) == 'POST') {
         if (is_array($post)) {
             $POST = array();
             foreach ($post as $name => $val) {
                 $POST[] = $name . '=' . urlencode($val);
             }
             $data = join('&', $POST);
             $query .= "Content-Type: application/x-www-form-urlencoded\r\n";
             $query .= 'Content-Length: ' . strlen($data) . "\r\n";
             $query .= "\r\n";
             $query .= $data;
         } else {
             $query .= 'Content-Length: ' . strlen($post) . "\r\n";
             $query .= "\r\n";
             $query .= $post;
         }
     } else {
         $query .= "\r\n";
     }
     $fp = fsockopen($via_proxy ? $proxy_host : $arr['host'], $via_proxy ? $proxy_port : $arr['port'], $errno, $errstr, 30);
     if (!$fp) {
         return array('query' => $query, 'rc' => $errno, 'header' => '', 'data' => $errstr);
     }
     fputs($fp, $query);
     $response = '';
     while (!feof($fp)) {
         if ($_response = fgets($fp, 4096)) {
             $response .= $_response;
         } else {
             return array('query' => $query, 'rc' => 408, 'header' => '', 'data' => 'Request Time-out');
         }
     }
     fclose($fp);
     $resp = explode("\r\n\r\n", $response, 2);
     $rccd = explode(' ', $resp[0], 3);
     // array('HTTP/1.1','200','OK\r\n...')
     return array('query' => $query, 'rc' => (int) $rccd[1], 'header' => $resp[0], 'data' => $resp[1]);
 }