public function xmlRequest($url = '', $data = '', $timeout = 60)
    {
        $this->debug->debug(__FUNCTION__, '/------------> ' . __FUNCTION__ . ' <------------\\');
        $inputParams = [
            'url'     => $url,
            'data'    => $data,
            'timeout' => $timeout,
        ];
        $this->debug->info(__FUNCTION__, 'input Params: ', $inputParams);
        $endpoint = trim($url);
        $this->debug->debug(__FUNCTION__, 'cURL Endpoint: ', $endpoint);
        if (!extension_loaded('curl')) {
            $this->debug->critical(__FUNCTION__, 'Server is not Support cURL, Please cURL. Library fallback user File Get Contents');
            // Create Request use File Get Content
            $content                  = new GetContents();
            $content->debugStatus     = $this->debugStatus;
            $content->debugLoggerPath = $this->debugLoggerPath;
            $content->__construct();
            $content->setURL($url);
            $content->setMethod('POST');
            $content->setXML(TRUE);
            $content->setData($data);
            $content->sendRequest();
            // Create Request
            $result     = $content->response();
            $getContent = $content->getContent();
            $getError   = $content->getError();
            $this->debug->debug(__FUNCTION__, 'Get Content Result: ' . $getContent);
            $this->debug->debug(__FUNCTION__, 'Get Error Result: ' . $getError);
        } else {
            $this->setRequestIsXml(TRUE);
            $this->setTimeout($timeout);
            $result = $this->curlRequest($url, $data, 'POST');
        }
        $this->debug->info(__FUNCTION__, 'Final Result from Request: ', $result);

        return $result;
    }
public function xmlRequest($url = '', $data = '', $timeout = 60)
    {
        $this->debug->debug(__FUNCTION__, '/------------> ' . __FUNCTION__ . ' <------------\\');
        $inputParams = [
            'url'     => $url,
            'data'    => $data,
            'timeout' => $timeout,
        ];
        $this->debug->info(__FUNCTION__, 'input Params: ', $inputParams);
        $endpoint = trim($url);
        $this->debug->debug(__FUNCTION__, 'cURL Endpoint: ', $endpoint);
        if (!extension_loaded('curl')) {
            $this->debug->critical(__FUNCTION__, 'Server is not Support cURL, Please cURL. Library fallback user File Get Contents');
            // Create Request use File Get Content
            $content                  = new GetContents();
            $content->debugStatus     = $this->debugStatus;
            $content->debugLoggerPath = $this->debugLoggerPath;
            $content->__construct();
            $content->setURL($url);
            $content->setMethod('POST');
            $content->setXML(TRUE);
            $content->setData($data);
            $content->sendRequest();
            // Create Request
            $result     = $content->response();
            $getContent = $content->getContent();
            $getError   = $content->getError();
            $this->debug->debug(__FUNCTION__, 'Get Content Result: ' . $getContent);
            $this->debug->debug(__FUNCTION__, 'Get Error Result: ' . $getError);
        } else {
            $this->setRequestIsXml(TRUE);
            $this->setTimeout($timeout);
            $result = $this->curlRequest($url, $data, 'POST');
        }
        $this->debug->info(__FUNCTION__, 'Final Result from Request: ', $result);

        return $result;
    }
public function xmlRequest ( $ url = '' , $ data = '' , $ timeout = 60 ) { $ this -> debug -> debug ( __FUNCTION__ , '/------------> ' . __FUNCTION__ . ' <------------\\' ) ; $ inputParams = [ 'url' => $ url , 'data' => $ data , 'timeout' => $ timeout , ] ; $ this -> debug -> info ( __FUNCTION__ , 'input Params: ' , $ inputParams ) ; $ endpoint = trim ( $ url ) ; $ this -> debug -> debug ( __FUNCTION__ , 'cURL Endpoint: ' , $ endpoint ) ; if ( ! extension_loaded ( 'curl' ) ) { $ this -> debug -> critical ( __FUNCTION__ , 'Server is not Support cURL, Please cURL. Library fallback user File Get Contents' ) ; // Create Request use File Get Content $ content = new GetContents ( ) ; $ content -> debugStatus = $ this -> debugStatus ; $ content -> debugLoggerPath = $ this -> debugLoggerPath ; $ content -> __construct ( ) ; $ content -> setURL ( $ url ) ; $ content -> setMethod ( 'POST' ) ; $ content -> setXML ( TRUE ) ; $ content -> setData ( $ data ) ; $ content -> sendRequest ( ) ; // Create Request $ result = $ content -> response ( ) ; $ getContent = $ content -> getContent ( ) ; $ getError = $ content -> getError ( ) ; $ this -> debug -> debug ( __FUNCTION__ , 'Get Content Result: ' . $ getContent ) ; $ this -> debug -> debug ( __FUNCTION__ , 'Get Error Result: ' . $ getError ) ; } else { $ this -> setRequestIsXml ( TRUE ) ; $ this -> setTimeout ( $ timeout ) ; $ result = $ this -> curlRequest ( $ url , $ data , 'POST' ) ; } $ this -> debug -> info ( __FUNCTION__ , 'Final Result from Request: ' , $ result ) ; return $ result ; }
Function xmlRequest
Send XML Request to Server

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 10/7/18 07:11

@param string $url     URL Endpoint to be Request
@param string $data    Data Content to be Request
@param int    $timeout Timeout Request

@return array|null|string Response from Server
Function xmlRequest Send XML Request to Server