public function request($controlUrl, $service = null, $method = null, $arguments = [])
    {
        $controlUrl = ltrim($controlUrl, '/');
        $url = 'http://' . $this->ip . '/' . $controlUrl;
        $action = $service . '#' . $method;

        $xmlHeader = '<?xml version="1.0" encoding="utf-8"?>
                      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                      <s:Body>
                      <u:' . $method . ' xmlns:u="' . $service . '">';

        $xmlFooter = '</u:' . $method . '></s:Body></s:Envelope>';

        $xmlBody = '';

        foreach ($arguments as $key => $value) {
            $xmlBody .= '<' . $key . '>' . $value . '</' . $key . '>';
        }

        $xml = $xmlHeader . $xmlBody . $xmlFooter;

        try {
            $options = [
                CURLOPT_URL            => $url,
                CURLOPT_POST           => true,
                CURLOPT_PORT           => $this->port,
                CURLOPT_POSTFIELDS     => $xml,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_VERBOSE        => WS::config()->get('debug', false),
                CURLOPT_HTTPHEADER     => [
                    'Content-Type:text/xml',
                    'SOAPACTION:"' . $action . '"'
                ]
            ];

            $ch = curl_init();
            curl_setopt_array($ch, $options);
            $response = curl_exec($ch);
        } catch (\Exception $e) {
            throw $e;
        }

        return $this->formatResponse($response);
    }
public function request($controlUrl, $service = null, $method = null, $arguments = [])
    {
        $controlUrl = ltrim($controlUrl, '/');
        $url = 'http://' . $this->ip . '/' . $controlUrl;
        $action = $service . '#' . $method;

        $xmlHeader = '<?xml version="1.0" encoding="utf-8"?>
                      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                      <s:Body>
                      <u:' . $method . ' xmlns:u="' . $service . '">';

        $xmlFooter = '</u:' . $method . '></s:Body></s:Envelope>';

        $xmlBody = '';

        foreach ($arguments as $key => $value) {
            $xmlBody .= '<' . $key . '>' . $value . '</' . $key . '>';
        }

        $xml = $xmlHeader . $xmlBody . $xmlFooter;

        try {
            $options = [
                CURLOPT_URL            => $url,
                CURLOPT_POST           => true,
                CURLOPT_PORT           => $this->port,
                CURLOPT_POSTFIELDS     => $xml,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_VERBOSE        => WS::config()->get('debug', false),
                CURLOPT_HTTPHEADER     => [
                    'Content-Type:text/xml',
                    'SOAPACTION:"' . $action . '"'
                ]
            ];

            $ch = curl_init();
            curl_setopt_array($ch, $options);
            $response = curl_exec($ch);
        } catch (\Exception $e) {
            throw $e;
        }

        return $this->formatResponse($response);
    }
public function request ( $ controlUrl , $ service = null , $ method = null , $ arguments = [ ] ) { $ controlUrl = ltrim ( $ controlUrl , '/' ) ; $ url = 'http://' . $ this -> ip . '/' . $ controlUrl ; $ action = $ service . '#' . $ method ; $ xmlHeader = '<?xml version="1.0" encoding="utf-8"?>
                      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                      <s:Body>
                      <u:' . $ method . ' xmlns:u="' . $ service . '">' ; $ xmlFooter = '</u:' . $ method . '></s:Body></s:Envelope>' ; $ xmlBody = '' ; foreach ( $ arguments as $ key => $ value ) { $ xmlBody .= '<' . $ key . '>' . $ value . '</' . $ key . '>' ; } $ xml = $ xmlHeader . $ xmlBody . $ xmlFooter ; try { $ options = [ CURLOPT_URL => $ url , CURLOPT_POST => true , CURLOPT_PORT => $ this -> port , CURLOPT_POSTFIELDS => $ xml , CURLOPT_RETURNTRANSFER => true , CURLOPT_VERBOSE => WS :: config ( ) -> get ( 'debug' , false ) , CURLOPT_HTTPHEADER => [ 'Content-Type:text/xml' , 'SOAPACTION:"' . $ action . '"' ] ] ; $ ch = curl_init ( ) ; curl_setopt_array ( $ ch , $ options ) ; $ response = curl_exec ( $ ch ) ; } catch ( \ Exception $ e ) { throw $ e ; } return $ this -> formatResponse ( $ response ) ; }
Makes requests to devices.

@param string $controlUrl
@param string $service
@param string $method
@param array  $arguments

@return array|string
@throws \Exception
Makes requests to devices .