當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ccurl::getHeaders方法代碼示例

本文整理匯總了PHP中ccurl::getHeaders方法的典型用法代碼示例。如果您正苦於以下問題:PHP ccurl::getHeaders方法的具體用法?PHP ccurl::getHeaders怎麽用?PHP ccurl::getHeaders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ccurl的用法示例。


在下文中一共展示了ccurl::getHeaders方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GetTargetedSize

function GetTargetedSize($URI)
{
    $ExpectedSize = 0;
    $curl = new ccurl($URI);
    $curl->NoLocalProxy();
    $Headers = $curl->getHeaders();
    if (isset($Headers["Content-Length"])) {
        return $Headers["Content-Length"];
    }
    if ($ExpectedSize == 0) {
        if (isset($Headers["download_content_length"])) {
            return $Headers["download_content_length"];
        }
    }
    return 0;
}
開發者ID:articatech,項目名稱:artica,代碼行數:16,代碼來源:exec.windowsupdate-partials.php

示例2: Getheaders

function Getheaders()
{
    $curl = new ccurl("http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz");
    print_r($curl->getHeaders());
}
開發者ID:BillTheBest,項目名稱:1.6.x,代碼行數:5,代碼來源:exec.geoip.update.php

示例3: ufdb_phistank

function ufdb_phistank()
{
    $unix = new unix();
    $sock = new sockets();
    $EnableSquidPhishTank = intval($sock->GET_INFO("EnableSquidPhishTank"));
    $PhishTankApiKey = $sock->GET_INFO("PhishTankApiKey");
    if ($EnableSquidPhishTank == 0) {
        updatev2_progress(80, "Phishtank {disabled}...");
        return;
    }
    if ($PhishTankApiKey == null) {
        updatev2_progress(80, "Phishtank {disabled}...");
        echo "Warning, API Key is not set, aborting...\n";
        return;
    }
    $path = "/home/artica/squid/phishtank/online-valid.php_serialized";
    $FinalPath = "/home/artica/squid/phishtank";
    $uri = "http://data.phishtank.com/data/{$PhishTankApiKey}/online-valid.php_serialized";
    $curl = new ccurl($uri);
    @mkdir(dirname($path), 0755, true);
    $heads = $curl->getHeaders();
    if (!isset($heads["http_code"])) {
        updatev2_progress(80, "Phishtank {failed}...");
        echo "phishtank: Unable to get header information\n";
        squid_admin_mysql(1, "phishtank: Unable to get header information", null, __FILE__, __LINE__);
        return;
    }
    $http_code = intval($heads["http_code"]);
    if ($http_code != 200) {
        updatev2_progress(80, "Phishtank {failed}...");
        echo "Unable to get header information error code {$http_code}\n";
        squid_admin_mysql(1, "phishtank: Unable to get header information error code {$http_code}", null, __FILE__, __LINE__);
        return;
    }
    $Time = $heads["Last-Modified"];
    $MyDate = $sock->GET_INFO("PhishTankLastDate");
    echo "Last date: {$Time}\n";
    if (!is_file($path)) {
        $MyDate = null;
    }
    if ($Time == $MyDate) {
        updatev2_progress(80, "Phishtank {no_update}...");
        echo "No new update...\n";
        return;
    }
    $tmpfile = $unix->FILE_TEMP();
    if (!$curl->GetFile($tmpfile)) {
        updatev2_progress(80, "Phishtank {failed}...");
        echo "Unable to download online-valid.php_serialized\n";
        squid_admin_mysql(1, "phishtank: Unable to download online-valid.php_serialized, {$curl->error}", null, __FILE__, __LINE__);
        @unlink($tmpfile);
        return;
    }
    @unlink($path);
    if (!@copy($tmpfile, $path)) {
        updatev2_progress(80, "Phishtank {failed}...");
        echo "Unable to copy online-valid.php_serialized\n";
        squid_admin_mysql(1, "phishtank: Unable to copy online-valid.php_serialized", null, __FILE__, __LINE__);
        @unlink($tmpfile);
        return;
    }
    @unlink($tmpfile);
    $size = @filesize($path);
    updatev2_progress(80, "Phishtank {compiling}...");
    squid_admin_mysql(2, "phishtank: Success to download new phishtank database (" . FormatBytes($size / 1024) . ")", null, __FILE__, __LINE__);
    $sock->SET_INFO("PhishTankLastDate", $Time);
    ufdb_phistank_createdb();
}
開發者ID:articatech,項目名稱:artica,代碼行數:68,代碼來源:exec.squid.blacklists.php

示例4: GetTargetedSize

function GetTargetedSize($URI)
{
    $ExpectedSize = 0;
    $curl = new ccurl($URI);
    $curl->FollowLocation = true;
    $Headers = $curl->getHeaders();
    if (isset($Headers["Content-Length"])) {
        return $Headers["Content-Length"];
    }
    if ($ExpectedSize == 0) {
        if (isset($Headers["download_content_length"])) {
            return $Headers["download_content_length"];
        }
    }
    while (list($index, $value) = each($Headers)) {
        events("Failed {$index} {$value}", __LINE__);
    }
    return 0;
}
開發者ID:articatech,項目名稱:artica,代碼行數:19,代碼來源:exec.windowsupdate.php


注:本文中的ccurl::getHeaders方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。