本文整理汇总了PHP中ccurl::GetHeads方法的典型用法代码示例。如果您正苦于以下问题:PHP ccurl::GetHeads方法的具体用法?PHP ccurl::GetHeads怎么用?PHP ccurl::GetHeads使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ccurl
的用法示例。
在下文中一共展示了ccurl::GetHeads方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HyperCacheGetMimeType
function HyperCacheGetMimeType($uri, $ID)
{
$curl = new ccurl($uri);
if (!$curl->GetHeads()) {
events("headers {failed} {$uri} Error number: {$curl->CURLINFO_HTTP_CODE}", $ID, 1, __LINE__);
return "NONE_{$curl->CURLINFO_HTTP_CODE}";
}
if ($curl->CURLINFO_HTTP_CODE == 501) {
return "NONE_501";
}
$content_type = $curl->CURL_ALL_INFOS["content_type"];
if (strpos($content_type, ";") > 0) {
$tbl = explode(";", $content_type);
$content_type = trim($tbl[0]);
}
return $content_type;
}
示例2: ufdbtables
function ufdbtables($nopid = false)
{
$unix = new unix();
$sock = new sockets();
if (!$nopid) {
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$nohup = $unix->find_program("nohup");
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid, __FILE__)) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
updatev2_progress(110, "Error, {$timepid} already running [" . __LINE__ . "]");
if (!$GLOBALS["NOLOGS"]) {
// ufdbguard_admin_events("UFDB::Warning: Task already executed PID: $pid since {$timepid}Mn",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
return;
}
}
@file_put_contents($pidfile, getmypid());
}
$GLOBALS["EVENTS"] = array();
$CACHE_FILE = "/etc/artica-postfix/ufdb.tables.db";
updatev2_progress(10, "CACHE_FILE = {$CACHE_FILE} [" . __LINE__ . "]");
$sock = new sockets();
$EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient"));
if ($EnableArticaMetaClient == 1) {
updatev2_progress(10, "Using Artica Meta console [" . __LINE__ . "]");
return ufdbtables_artica_meta();
}
$UseRemoteUfdbguardService = $sock->GET_INFO('UseRemoteUfdbguardService');
if (!is_numeric($UseRemoteUfdbguardService)) {
$UseRemoteUfdbguardService = 0;
}
if ($UseRemoteUfdbguardService == 1) {
updatev2_progress(10, "UseRemoteUfdbguardService = TRUE - aborting [" . __LINE__ . "]");
return;
}
if ($GLOBALS["MIRROR"] == null) {
updatev2_progress(10, "MIRROR is null #2 [" . __LINE__ . "]");
unset($GLOBALS["updatev2_checkversion"]);
updatev2_checkversion();
}
if ($GLOBALS["MIRROR"] == null) {
updatev2_progress(110, "MIRROR is null #1 [" . __LINE__ . "]");
return;
}
$tmpdir = $unix->TEMP_DIR();
$URIBASE = $GLOBALS["MIRROR"];
$WORKDIR = $GLOBALS["WORKDIR_LOCAL"];
if (is_link($WORKDIR)) {
$WORKDIR = readlink($WORKDIR);
}
$CategoriesDatabasesByCron = $sock->GET_INFO("CategoriesDatabaseByCron");
if (!is_numeric($CategoriesDatabasesByCron)) {
$CategoriesDatabasesByCron = 1;
}
if (!$GLOBALS["FORCE"]) {
if ($CategoriesDatabasesByCron == 1) {
if (!$GLOBALS["BYCRON"]) {
updatev2_progress(110, "{done} CategoriesDatabasesByCron [" . __LINE__ . "]");
return;
}
}
}
updatev2_progress(15, "{$URIBASE}/index.txt [" . __LINE__ . "]");
$curl = new ccurl("{$URIBASE}/index.txt");
$STATUS = unserialize(@file_get_contents("/etc/artica-postfix/ARTICAUFDB_LAST_DOWNLOAD"));
$STATUS["LAST_DOWNLOAD"]["LAST_CHECK"] = time();
@file_put_contents("/etc/artica-postfix/ARTICAUFDB_LAST_DOWNLOAD", serialize($STATUS));
if (!$curl->GetHeads()) {
if ($GLOBALS["VERBOSE"]) {
echo "Fatal ! {$URIBASE}/index.txt ERROR NUMBER {$curl->CURLINFO_HTTP_CODE}\n";
}
if ($curl->CURLINFO_HTTP_CODE == 404 or $curl->CURLINFO_HTTP_CODE == 300) {
if (!preg_match("#\\/ufdb#", $URIBASE)) {
$URIBASE = "{$URIBASE}/ufdb";
}
$curl = new ccurl("{$URIBASE}/index.txt");
if (!$curl->GetHeads()) {
$GLOBALS["EVENTS"][] = "{$URIBASE}/index.txt";
$GLOBALS["EVENTS"][] = "Failed with error {$curl->error}";
while (list($a, $b) = each($GLOBALS["CURLDEBUG"])) {
$GLOBALS["EVENTS"][] = $b;
}
squid_admin_mysql(0, "Unable to download blacklist index file with error: `{$curl->error}`", @implode("\n", $GLOBALS["EVENTS"]), __FUNCTION__, __LINE__);
artica_update_event(0, "Unable to download Artica blacklist index file `{$curl->error}`", @implode("\n", $GLOBALS["EVENTS"]), __FUNCTION__, __LINE__);
// ufdbguard_admin_events("UFDB::Fatal: Unable to download blacklist index file $curl->error",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
echo "UFDB: Failed to retreive {$URIBASE}/index.txt ({$curl->error})\n";
updatev2_progress(110, "Failed to retreive {$URIBASE}/index.txt [" . __LINE__ . "]");
updatev2_adblock();
return;
}
}
}
updatev2_progress(20, "Downloading MD5Strings.txt [" . __LINE__ . "]");
$curl = new ccurl("{$URIBASE}/MD5Strings.txt");
if (!$curl->GetFile("{$tmpdir}/MD5Strings.txt")) {
artica_update_event(2, "{$URIBASE}: Unable to download Artica blacklist MD5 table `{$curl->error}`", @implode("\n", $GLOBALS["EVENTS"]), __FUNCTION__, __LINE__);
@unlink("{$tmpdir}/MD5Strings.txt");
}
$MD5_strings = unserialize(@file_get_contents("{$tmpdir}/MD5Strings.txt"));
$source_filetime = $curl->CURL_ALL_INFOS["filetime"];
//.........这里部分代码省略.........