Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -379,32 +379,24 @@ XML;
|
||||
{
|
||||
throw new \IPS\Http\Request\Exception;
|
||||
}
|
||||
|
||||
|
||||
/* Interpret */
|
||||
$responseArray = array();
|
||||
$xml = new \IPS\Xml\XMLReader;
|
||||
$xml->xml( (string) $response, NULL, LIBXML_NONET );
|
||||
if ( $xml->read() )
|
||||
$doc = new \IPS\Xml\DOMDocument;
|
||||
$doc->loadXML( \IPS\Xml\DOMDocument::wrapHtml( (string) $response ) );
|
||||
|
||||
$data = iterator_to_array( $doc->getElementsByTagName( 'checkVatResponse' ) );
|
||||
|
||||
if ( isset( $data[0] ) AND \count( $data[0]->childNodes ) )
|
||||
{
|
||||
if ( $xml->name === 'soap:Envelope' and $xml->read() )
|
||||
foreach( $data[0]->childNodes AS $child )
|
||||
{
|
||||
if ( $xml->name === 'soap:Body' and $xml->read() )
|
||||
{
|
||||
if ( $xml->name === 'checkVatResponse' )
|
||||
{
|
||||
$xml->read();
|
||||
do
|
||||
{
|
||||
$responseArray[ $xml->name ] = $xml->readString();
|
||||
}
|
||||
while ( $xml->next() and $xml->nodeType !== $xml::END_ELEMENT );
|
||||
}
|
||||
}
|
||||
$responseArray[ $child->localName ] = $child->nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cache and return */
|
||||
if ( $responseArray and $responseArray['valid'] === 'true' )
|
||||
if ( isset( $responseArray['valid'] ) and $responseArray['valid'] === 'true' )
|
||||
{
|
||||
\IPS\Data\Cache::i()->storeWithExpire( $cacheKey, $responseArray, \IPS\DateTime::create()->add( new \DateInterval( 'P7D' ) ), TRUE );
|
||||
return $responseArray;
|
||||
|
||||
Reference in new issue
Block a user