function misc_exec_wget($url, $output_path = '.', $noclobber = 0, $wget_path = '/usr/local/bin/wget', $wget_opts = '', $debug = 0) { // global $wget_path; // global $wget_opts; // $debug = 0; // DEBUG // echo $url."\n"; if ($noclobber == 1) { if (file_exists($output_path)) { echo 'WARNING: file ' . $output_path . ' exists, skipping' . "\n"; return 1; } // DEBUG // echo $output_path."\n"; } // download $p = $wget_path . ' ' . $wget_opts . ' -U "' . random_user_agent() . '" "' . $url . '" -O "' . $output_path . '"'; // DEBUG if ($debug == 1) { echo $p . "\n"; } if ($debug == 1) { echo misc_exec($p, $debug); } else { misc_exec($p, $debug); } return 0; }
$p = str_replace("\n", '', $p); return $p; } // main () if ($argc < 2) { echo 'USAGE: rsstool2sql.php URL|FILE' . "\n\n"; exit; } $debug = 0; $tmp = tempnam(sys_get_temp_dir(), 'rsstool2sql_'); // DEBUG // echo $tmp."\n"; $p = $rsstool_path . ' ' . $rsstool_opts . ' --xml "' . $argv[1] . '" -o "' . $tmp . '"'; // DEBUG echo $p . "\n"; echo misc_exec($p, $debug); $xml = simplexml_load_file($tmp); unlink($tmp); // DEBUG // print_r ($xml); // exit; // output $p = rsstool_write_ansisql($xml, NULL); $f = 'rsstool2sql.sql'; //$p = rsstool_write_csv ($xml); //$f = 'rsstool2csv.txt'; $fh = fopen($f, 'w'); if ($fh) { fwrite($fh, $p); fclose($fh); echo $f . ' written' . "\n";
function rrdtool_graph($file, $seconds, $img_w, $img_h) { return misc_exec("rrdtool graph " . $file . " -s -" . $seconds . " -a PNG" . " -w " . $img_w . " -h " . $img_h . " DEF:show=" . $this->rrd . ":values:AVERAGE LINE1:show#ff0000:Value", 1); }
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //phpinfo (); //error_reporting(E_ALL | E_STRICT); require_once '../htdocs/rsscache/default.php'; require_once '../htdocs/config.php'; require_once '../htdocs/misc/misc.php'; require_once '../htdocs/misc/sql.php'; require_once '../htdocs/misc/rss.php'; require_once '../htdocs/misc/youtube.php'; require_once '../htdocs/rsscache/rsscache_sql.php'; require_once '../htdocs/rsscache/rsscache_misc.php'; // main () // unlimited execution time //ini_set('max_execution_time', '3600'); set_time_limit(0); rsscache_sql_open(); $config = config_xml(); echo misc_exec('/etc/init.d/tor restart'); // DEBUG echo 'database: ' . $rsscache_dbname . ' (' . $rsscache_dbuser . ')' . "\n"; for ($i = 0; isset($config['item'][$i]); $i++) { if (isset($config['item'][$i]['category'])) { print_r($config['item'][$i]); rsscache_download_feeds_by_category($config['item'][$i]['category']); } } rsscache_sql_close(); exit;