Feed/XML Connector Service 

Language

en

Version

6.0

Description

Connector service for reading XML files or RSS feeds.

Keywords

xml, rss, feed, data import, fetch data

Copyright

2009-2026

Author

François Suter (Idéative)

Email

typo3@ideative.ch

License

This document is published under the Creative Commons BY 4.0 license.

Rendered

Wed, 22 Apr 2026 10:56:29 +0000

The content of this document is related to TYPO3, a GNU/GPL CMS/Framework available from www.typo3.org.

Introduction 

This extension implements a specific connector service for reading XML files, be they local or remote. In particular it can be used to easily get the contents of a RSS feed.

Questions and support 

If you have any questions about this extension, please ask them in the TYPO3 English mailing list, so that others can benefit from the answers. Please use the bug tracker on GitHub to report problem or suggest features (https://github.com/cobwebch/svconnector_feed/issues).

Keeping the developer happy 

Every encouragement keeps the developer ticking, so don't hesitate to send thanks or share your enthusiasm about the extension. If you really want to give something back, you may consider my Amazon wish list: http://www.amazon.co.uk/registry/wishlist/G7DI2AN99Y4F

You may also take a step back and reflect about the beauty of sharing. Think about how much you are benefiting and how much yourself is giving back to the community.

Installation 

Install this extension and you can start using its API for reading XML files inside your own code. It requires extension “svconnector” which provides the base for all connector services.

Updating to 6.0.0 

Version 6.0.0 adds support for TYPO3 14 and PHP 8.5, while dropping support for TYPO3 12 and PHP 8.1.

A new parameter requestOptions is available. It makes it possible to use any of the request options supported by Guzzle HTTP. The "headers" parameter has been deprecated. Headers should be passed as part of the "requestOptions" instead.

Encoding is now guessed from the declaration of the XML source, if defined.

Hooks have been entirely removed. Use only events.

Updating to 5.0.0 

Version 5.0.0 adds support for TYPO3 13 and PHP 8.4, while dropping support for TYPO3 11 and PHP 7.4 and 8.0.

Events have been introduced to replace hooks. Existing hooks are still in place, but are deprecated and events should now be used instead (see the svconnector manual for reference).

It is now possible to choose another method that "GET" when querying data, as well as passing any number of headers as array.

Updating to 4.0.0 

Version 4.0.0 adds support for TYPO3 12 and PHP 8.1, while dropping support for TYPO3 10. It adapts to the new way of registering Connector Services. The update process should be smooth with "svconnector" version 5.0.0.

Updating to 3.0.0 

Version 3.0.0 adds support for TYPO3 11 and PHP 8.0, while dropping support for TYPO3 8 and 9. Apart from that it does not contain other changes and the update process should be smooth.

Updating to version 2.4.0 

The "encoding" configuration property has change behavior. It used to accept all known encoding values plus all the synonyms defined in array \TYPO3\CMS\Core\Charset\CharsetConverter::$synonyms. This array does not exist in TYPO3 v10 anymore, thus usage of synonyms has been dropped. Check your configuration and verify that you use encoding names as defined in https://www.php.net/manual/en/mbstring.supported-encodings.php.

Configuration 

This chapter describes the parameters that can be used to configure the Feed/XML connector service.

uri 

Type
string
Description

URI of the XML file to read. This may be any of the following syntaxes:

  • absolute file path: /var/foo/web/fileadmin/import/bar.xml (within the TYPO3 root path or TYPO3_CONF_VARS[BE][lockRootPath])
  • file path relative to the TYPO3 root: fileadmin/import/foo.xml
  • file path using EXT:: EXT:foo/Resources/Private/Data/bar.xml
  • fully qualified URL, e.g. http://www.example.com/foo.xml
  • FAL reference with storage ID and file identifier: FAL:2:/foo.xml
  • custom syntax: MYKEY:whatever_you_want, see Connector Services

method 

Type
string
Description
Method used to get the file (GET, POST, or whatever else is relevant). This parameter is optional and the method defaults to GET.

requestOptions 

Type
array
Description

Key-value pairs of options that can be passed to the request. Any of the request options supported by Guzzle HTTP may be used.

Example

Passing a "page" information in the body and setting an accepted mime type in the headers.

'requestOptions' => [
   'body' => '{"page": 1}',
   'headers' => [
      'Accept' => 'application/xml',
   ],
],
Copied!

headers 

Type
array
Description

Key-value pairs of headers that should be sent along with the request.

Example

Example headers for setting an alternate user agent and defining what reponse format to accept.

'headers' => [
   'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:75.0) Gecko/20100101 Firefox/75.0',
   'Accept' => 'application/xml',
]
Copied!

encoding 

Type
string
Description

Encoding of the data found in the file. This value must match any of the encoding values recognized by the PHP libray "mbstring". See https://www.php.net/manual/en/mbstring.supported-encodings.php

It is not necessary to define this parameter if the XML source contains an encoding in its declaration. It will automatically be retrieved. However, if this parameter is defined, it supersedes the encoding from the XML declaration.

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 fetchRaw() method will return the same.

The fetchArray() method returns an array version of the XML transformed using CobwebSvconnectorUtilityConnectorUtility::convertXmlToArray(). The returned array has a rather complex structure, but it ensures that no information is lost.

Sitemap