本文整理汇总了PHP中ccurl::postFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ccurl::postFile方法的具体用法?PHP ccurl::postFile怎么用?PHP ccurl::postFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ccurl
的用法示例。
在下文中一共展示了ccurl::postFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ccurl
}
$curl = new ccurl("https://{$hostname}:{$listen_port}/nodes.listener.php?PING=YES");
if ($send_listen_ip != null) {
$curl->interface = $send_listen_ip;
}
$curlparms["listen_addr"] = $listen_addr;
$curl = new ccurl("https://{$hostname}:{$listen_port}/nodes.listener.php");
if ($send_listen_ip != null) {
$curl->interface = $send_listen_ip;
}
$curlparms["listen_addr"] = $listen_addr;
$unix = new unix();
$curlparms["hostname"] = $unix->hostname_g();
$sql = "SELECT servername FROM freeweb";
$q = new mysql();
$results = $q->QUERY_SQL($sql, 'artica_backup');
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
$curlparms["FREEWEBS_SRV"][$ligne["servername"]] = true;
}
@file_put_contents("/usr/share/artica-postfix/ressources/logs/web/com.txt", base64_encode(serialize($curlparms)));
$net = new netagent();
$net->compress("/usr/share/artica-postfix/ressources/logs/web/com.txt", "/usr/share/artica-postfix/ressources/logs/web/com.txt.gz");
@unlink("/usr/share/artica-postfix/ressources/logs/web/com.txt");
$curl->x_www_form_urlencoded = true;
if (!$curl->postFile("DNS_LINKER", "/usr/share/artica-postfix/ressources/logs/web/com.txt.gz", array("CREDS" => $EnableDNSLinkerCreds["CREDS"], "VERBOSE" => "TRUE"))) {
echo "Posting informations Failed {$curl->error}...\n";
@unlink("/usr/share/artica-postfix/ressources/logs/web/com.txt.gz");
}
if ($GLOBALS["VERBOSE"]) {
echo $curl->data . "\n";
}
示例2: SendToStatisticsAppliance
function SendToStatisticsAppliance()
{
$sock = new sockets();
$EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
if (!is_numeric($EnableRemoteStatisticsAppliance)) {
$EnableRemoteStatisticsAppliance = 0;
}
if ($EnableRemoteStatisticsAppliance == 0) {
return;
}
include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
$unix = new unix();
$tar = $unix->find_program("tar");
if ($GLOBALS["VERBOSE"]) {
if (is_file("/opt/artica/share/www/squid/rrd/graphs.tar.gz")) {
@unlink("/opt/artica/share/www/squid/rrd/graphs.tar.gz");
}
}
chdir("/opt/artica/share/www/squid/rrd");
shell_exec("{$tar} -czf graphs.tar.gz *");
$uri = $unix->SquidStatsApplianceUri();
$curl = new ccurl("{$uri}/squid.blocks.listener.php");
$curl->noproxyload = true;
$hostname = $unix->FULL_HOSTNAME();
if (!$curl->postFile("SQUID_GRAPHS", "/opt/artica/share/www/squid/rrd/graphs.tar.gz", array("HOSTNAME" => $hostname))) {
echo "Failed -> `{$uri}/squid.blocks.listener.php`\n";
return;
}
echo "Success....\n";
}
示例3: PUSH_STATS_FILE
function PUSH_STATS_FILE($filepath)
{
$sock = new sockets();
$unix = new unix();
$q = new mysql_squid_builder();
$EnableSquidRemoteMySQL = intval($sock->GET_INFO("EnableSquidRemoteMySQL"));
events("PUSH_STATS_FILE: EnableSquidRemoteMySQL = {$EnableSquidRemoteMySQL}");
$WizardStatsAppliance = unserialize(base64_decode($sock->GET_INFO("WizardStatsAppliance")));
if (isset($WizardStatsAppliance["SERVER"])) {
if ($WizardStatsAppliance["SERVER"] != null) {
$EnableSquidRemoteMySQL = 1;
}
}
$proto = "http";
if ($WizardStatsAppliance["SSL"] == 1) {
$proto = "https";
}
$uri = "{$proto}://{$WizardStatsAppliance["SERVER"]}:{$WizardStatsAppliance["PORT"]}/nodes.listener.php";
if ($EnableSquidRemoteMySQL == 0) {
return false;
}
$size = @filesize($filepath);
$filename = basename($filepath);
$array = array("SQUID_BEREKLEY" => true, "UUID" => $unix->GetUniqueID(), "HOSTNAME" => $unix->hostname_g(), "SIZE" => $size, "FILENAME" => $filename);
$curl = new ccurl($uri, false, null, true);
$curl->x_www_form_urlencoded = false;
if (!$curl->postFile(basename($filepath), $filepath, $array)) {
events("PUSH_STATS_FILE: Failed " . $curl->error);
return false;
}
return true;
}
示例4: export_push
function export_push()
{
$sock = new sockets();
$unix = new unix();
$export_stamp = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".EXPORT.time";
$export_time = $unix->file_time_min($export_stamp);
if ($export_time < 60) {
return;
}
$ArticaProxyStatisticsBackupFolder = $sock->GET_INFO("ArticaProxyStatisticsBackupFolder");
if ($ArticaProxyStatisticsBackupFolder == null) {
$ArticaProxyStatisticsBackupFolder = "/home/artica/squid/backup-statistics";
}
$ArticaProxyStatisticsBackupFolder = $ArticaProxyStatisticsBackupFolder . "/export";
$WizardStatsAppliance = unserialize(base64_decode($sock->GET_INFO("WizardStatsAppliance")));
$proto = "http";
if ($WizardStatsAppliance["SSL"] == 1) {
$proto = "https";
}
$uri = "{$proto}://{$WizardStatsAppliance["SERVER"]}:{$WizardStatsAppliance["PORT"]}/nodes.listener.php";
if ($GLOBALS["VERBOSE"]) {
echo "{$uri}\n";
}
$credentials["MANAGER"] = $WizardStatsAppliance["MANAGER"];
$credentials["PASSWORD"] = $WizardStatsAppliance["MANAGER-PASSWORD"];
$files = $unix->DirFiles($ArticaProxyStatisticsBackupFolder);
Export_logs("PUSH Scanning {$ArticaProxyStatisticsBackupFolder}");
while (list($filename, $none) = each($files)) {
$size = @filesize("{$ArticaProxyStatisticsBackupFolder}/{$filename}");
Export_logs("PUSH Scanning {$ArticaProxyStatisticsBackupFolder}/{$filename} ( {$size} bytes )");
$array = array("UUID" => $unix->GetUniqueID(), "HOSTNAME" => $unix->hostname_g(), "SIZE" => $size, "FILENAME" => $filename, "creds" => base64_encode(serialize($credentials)));
if ($GLOBALS["VERBOSE"]) {
echo "PUSH {$ArticaProxyStatisticsBackupFolder}/{$filename}\n";
}
$curl = new ccurl($uri, false, null, true);
if (!$curl->postFile("SQUID_STATS_CONTAINER", "{$ArticaProxyStatisticsBackupFolder}/{$filename}", $array)) {
if ($GLOBALS["VERBOSE"]) {
echo "Posting informations Failed {$curl->error}...\n";
}
Export_logs("Failed {$curl->error}");
continue;
}
if (!preg_match("#<RESULTS>(.*?)</RESULTS>#is", $curl->data, $re)) {
Export_logs("{$WizardStatsAppliance["SERVER"]} did not report something");
stats_admin_events(0, "{$WizardStatsAppliance["SERVER"]} did not report something", $curl->data, __FILE__, __LINE__);
continue;
}
$RESULT = $re[1];
Export_logs("RESULT = {$RESULT}");
if ($RESULT != "SUCCESS") {
Export_logs("Failed, {$WizardStatsAppliance["SERVER"]} report {$RESULT} ");
stats_admin_events(0, "{$WizardStatsAppliance["SERVER"]} report {$RESULT}", $curl->data, __FILE__, __LINE__);
continue;
}
Export_logs("Success, removing {$ArticaProxyStatisticsBackupFolder}/{$filename}");
@unlink("{$ArticaProxyStatisticsBackupFolder}/{$filename}");
stats_admin_events(0, "Success uploading {$filename} to {$WizardStatsAppliance["SERVER"]} report {$RESULT}", $curl->data, __FILE__, __LINE__);
}
}