HEX
Server: nginx/1.22.1
System: Linux VM-16-9-centos 3.10.0-1160.99.1.el7.x86_64 #1 SMP Wed Sep 13 14:19:20 UTC 2023 x86_64
User: www (1001)
PHP: 7.3.31
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/oa.sanjiangapp.com/lib/http/http.class.php
<?php
class http
{
    public $app;
    public $config;
    public $snoopy;
    public $logs;

    /**
     * Construct function, init app, config and snoopy.
     * 
     * @access public
     * @return void
     */
    public function __construct()
    {
        global $app, $config;
        $this->app    = $app;
        $this->config = $config;
        $this->snoopy = $this->app->loadClass('snoopy');
    }

    /**
     * Fetch a url by get.
     * 
     * @param  string    $url 
     * @access public
     * @return string
     */
    public function get($url)
    {
        $this->snoopy->fetch($url);
        $results = $this->snoopy->results;
        $this->log($url, $results);
        return $results;
    }

    /**
     * Post a request.
     * 
     * @param  string   $url 
     * @param  array    $vars 
     * @access public
     * @return string
     */
    public function post($url, $vars)
    {
        $this->snoopy->submit($url, $vars);
        $results = $this->snoopy->results;
        $this->log($url, $results);
        return $results;
    }

    /**
     * Log the url and results to a log file.
     * 
     * @param  string    $url 
     * @param  string    $results 
     * @access public
     * @return string
     */
    public function log($url, $results)
    {
        $logFile = $this->app->getLogRoot() . 'saas.'. date('Ymd') . '.log';
        $fh = @fopen($logFile, 'a');
        if(!$fh) return false;

        fwrite($fh, date('Ymd H:i:s') . ": " . $this->app->getURI() . "\n");
        fwrite($fh, "url:    " . $url . "\n");
        fwrite($fh, "results:" . print_r($results, true));
        fwrite($fh, "\n");
        fclose($fh);
    }
}