Skip to content
Bastian Feder edited this page Dec 28, 2010 · 1 revision

By definition a a feed is to be pulled from a vendor (feed provider) serving data on each request. In our terms this will be done by a cronjob sending a HTTP request to a feed provider asking for information.

Cronjob

Symfony provides a script to enable special prepared Bundles to be called from the command line. The ImportBundle does meet these expectations and therefor can be used to import data from a web-service. The permissions for caching (app/cache) and logging (app/logs) has to be set to writable for the current logged in user and the user of the webserver to prevent "Permission denied" messages.

Synopsis

The provided script is located in the app folder of the project and is called console. It is to be called as shown in the following example.

`>php app/console nzz:importer --help

Usage: nzz:importer service feed

Arguments: service The name of the service to be used to import the retrieved data. feed The feed to be read.

Help: To find the available 'services' consult app/config/config.yml.

Every service prefixed with 'import.importer.' is a candidate for being used as a the value of the 'service' parameter. E.g.: import.importer.faz.books to call this service use 'faz.books' as the parameter value.

Example

php app/console nzz:importer faz.books http://www.faz.net/s/Rub1DA1FB848C1E44858CB87A0FE6AD1B68/Tpl~Epartner~SRss_.xml`

Configuration

Fortunately there is no specific configuration to be done.

Feedreader

This PHP cli script was for intermediate use to present the functionality of an existing web-service importing content send via HTTP request. It just builds the bridge between a feed and the web-service to be called. You find the PHP cli script in the Scripts folder of the ImportBundle. Do not rely on the proper and correct functionality of this script. If you want to import data from a feed you should always use the cronjob!

Synopsis

The command line which has to be executed to start the Import of the feed into the webservice:

>php feedReader.php [--feed=<feed url>] [--service=<service url>] [--proxy=<proxy address>] [--help]

Calling the script without any arguments or useing --help as argument the list of available options will be displayed.

`>php feedReader.php --help

OPTIONS: --feed/-f URL of the feed to be read. --service/-s URL of the service to be fed. --proxy/-p URL of the proxy to be used. --help Show this information.`

Example

This example fetches the FAZ-book feed and routes the data as a request to the local setup virtual host http://nzz.lo.

>php feedReader.php --service=http://nzz.lo/index_dev.php/fazbooks --feed=http://www.faz.net/s/Rub1DA1FB848C1E44858CB87A0FE6AD1B68/Tpl~Epartner~SRss_.xml

Clone this wiki locally