Developer's manual
Reading a XML file using the Feed/XML connector service is a really easy task. The first step is to get the proper service object with the desired parameters:
$parameters = [
'uri' => 'https://typo3.org/xml-feeds/rss.xml',
'encoding' => 'utf-8',
];
$registry = GeneralUtility::makeInstance(\Cobweb\Svconnector\Registry\ConnectorRegistry::class);
$connector = $registry->getServiceForType('feed');
Copied!
The next step is simply to call the appropriate method from the API depending on which format you want to have in return. For example:
$data = $connector->fetchXML($parameters);
Copied!
This will return the XML from the feed as a string. The fetch
method will return the same.
The fetch
method returns an array version of the XML
transformed using \Cobweb\
.
The returned array has a rather complex structure,
but it ensures that no information is lost.