protected function doExecute($command, $target = null, $value = null)
    {
        $postFields = array();
        $query = array('cmd' => $command);

        if ($target !== null) {
            $postFields[1] = $target;
        }

        if ($value !== null) {
            $postFields[2] = $value;
        }

        if (null !== $this->sessionId) {
            $query['sessionId'] = $this->sessionId;
        }

        $query = http_build_query($query);
        $url = $this->url.'?'.$query;

        //open connection
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_POST, count($postFields));
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields));
        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        $result = curl_exec($ch);
        $curlErrno = curl_errno($ch);
        curl_close($ch);

        if ($curlErrno > 0) {
            throw new Exception("Unable to connect ! ");
        }

        if (false === $result) {
            throw new Exception("Connection refused");
        }

        return $result;
    }
protected function doExecute($command, $target = null, $value = null)
    {
        $postFields = array();
        $query = array('cmd' => $command);

        if ($target !== null) {
            $postFields[1] = $target;
        }

        if ($value !== null) {
            $postFields[2] = $value;
        }

        if (null !== $this->sessionId) {
            $query['sessionId'] = $this->sessionId;
        }

        $query = http_build_query($query);
        $url = $this->url.'?'.$query;

        //open connection
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_POST, count($postFields));
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields));
        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        $result = curl_exec($ch);
        $curlErrno = curl_errno($ch);
        curl_close($ch);

        if ($curlErrno > 0) {
            throw new Exception("Unable to connect ! ");
        }

        if (false === $result) {
            throw new Exception("Connection refused");
        }

        return $result;
    }
protected function doExecute ( $ command , $ target = null , $ value = null ) { $ postFields = array ( ) ; $ query = array ( 'cmd' => $ command ) ; if ( $ target !== null ) { $ postFields [ 1 ] = $ target ; } if ( $ value !== null ) { $ postFields [ 2 ] = $ value ; } if ( null !== $ this -> sessionId ) { $ query [ 'sessionId' ] = $ this -> sessionId ; } $ query = http_build_query ( $ query ) ; $ url = $ this -> url . '?' . $ query ; //open connection $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_POST , count ( $ postFields ) ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , http_build_query ( $ postFields ) ) ; curl_setopt ( $ ch , CURLOPT_TIMEOUT , $ this -> timeout ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; $ result = curl_exec ( $ ch ) ; $ curlErrno = curl_errno ( $ ch ) ; curl_close ( $ ch ) ; if ( $ curlErrno > 0 ) { throw new Exception ( "Unable to connect ! " ) ; } if ( false === $ result ) { throw new Exception ( "Connection refused" ) ; } return $ result ; }
Executes a raw command on the server and integrate the current session
identifier if available.

@param string $command Command to execute
@param string $target  First argument
@param string $value   Second argument

@return string The raw result of the command
Executes a raw command on the server and integrate the current session identifier if available .