Exemple #1
0
function install1()
{
    echo "<p>正在努力地下载数据包...</p>";
    ob_flush();
    $GLOBALS['xml'] = GetHttpContent('http://update.zblogcn.com/zblogphp/?install');
    //file_put_contents('release.xml',$GLOBALS['xml']);
}
Exemple #2
0
function misc_updateinfo()
{
    global $zbp;
    $r = GetHttpContent($zbp->option['ZC_UPDATE_INFO_URL']);
    $r = '<tr><td>' . $r . '</td></tr>';
    $zbp->LoadConfigs();
    $zbp->LoadCache();
    $zbp->cache->reload_updateinfo = $r;
    $zbp->cache->reload_updateinfo_time = time();
    $zbp->SaveCache();
    echo $r;
}
Exemple #3
0
function DoPost($url, $post_data = array())
{
    $url2 = parse_url($url);
    $url2["path"] = $url2["path"] == "" ? "/" : $url2["path"];
    $url2["port"] = $url2["port"] == "" ? 80 : $url2["port"];
    $host_ip = @gethostbyname($url2["host"]);
    $fsock_timeout = 2;
    //2 second
    if (($fsock = fsockopen($host_ip, $url2['port'], $errno, $errstr, $fsock_timeout)) < 0) {
        return false;
    }
    $request = $url2["path"] . ($url2["query"] ? "?" . $url2["query"] : "");
    $post_data2 = http_build_query($post_data);
    $in = "POST " . $request . " HTTP/1.0\r\n";
    $in .= "Accept: */*\r\n";
    $in .= "Host: " . $url2["host"] . "\r\n";
    $in .= "User-Agent: Lowell-Agent\r\n";
    $in .= "Content-type: application/x-www-form-urlencoded\r\n";
    $in .= "Content-Length: " . strlen($post_data2) . "\r\n";
    $in .= "Connection: Close\r\n\r\n";
    $in .= $post_data2 . "\r\n\r\n";
    unset($post_data2);
    if (!@fwrite($fsock, $in, strlen($in))) {
        fclose($fsock);
        return false;
    }
    return GetHttpContent($fsock);
}
Exemple #4
0
function AppCentre_GetHttpContent($url)
{
    if (function_exists("GetHttpContent")) {
        return GetHttpContent($url);
    }
    $r = null;
    if (function_exists("curl_init")) {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        if (ini_get("safe_mode") == false && ini_get("open_basedir") == false) {
            curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        }
        $r = curl_exec($ch);
        curl_close($ch);
    } elseif (ini_get("allow_url_fopen")) {
        $r = file_get_contents($url);
    }
    return $r;
}