当前位置: 首页>>代码示例>>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;未经允许,请勿转载。