Live Data Feed Integration

In the tradition of providing our affiliate partners the best services available.

Not only do we offer you the standard links, but also a number of easy ways to integrate search results display for use within your own site.

You should contact [email protected] if you plan on using the feed on your site. You must not alter the code in any way from what is listed below.

iFrame Include

The table below shows an example of the iframe data feed showing Aldershot fuel prices:

The code required to generate the above iframe is as follows:

<iframe style="border: 0px; width: 570px;" src="http://www.petrolprices.com/search-partner.html?search=aldershot"></iframe>

The data included in the iframe can be controlled through the use of the search argument. This may be specified as a full postcode, part postcode or town name. For example GU12, GU12 4RQ, and Aldershot are all valid values for search.

Javascript Include

The table below shows an example of the Javascript data feed showing Aldershot fuel prices:

The information box shows the minimum, maximum and average prices for each type of fuel in the Aldershot area from the last update. The area can easily be changed to suit your needs, if for example you want to show price data in a particular postcode, or county.

Here is the code required to generate the box used above:

<link rel="stylesheet" type="text/css" href="http://www.petrolprices.com/feeds/averages.css" />
<script type="text/javascript" src="http://www.petrolprices.com/feeds/averages-basic.php?search_type=town&search_value=aldershot"></script>

You may change the following variables in the Javascript include:

search_type
valid values are: postcode, town, county
search_value
example values: gu124rq, aldershot, hampshire

Calling the Javascript without a search_type argument will return the average prices for the whole of the UK.

You may alter the way national averages look by using the following parameters:

types
fuel types you would like to display (e.g. unleaded|diesel|super+unleaded)
title
heading you would prefer to use (e.g. National+Average+Prices)
simple
if set to ‘true’, will only display the average and not min. and max. values.

An additional argument of target may be added to the include specifying where the PetrolPrices.com link should open. To open the link in a new window the argument should be target=_blank. By default the link will open in the same window.

Advanced users may wish to change the style of the data feed box by excluding the stylesheet link in the above text and setting styles in their own stylesheet. Our stylesheet may be used as an example, and can be viewed here.

WordPress Widget

There is a WordPress plugin widget which makes use of the data feeds we provide. This makes it easy to include the averages, minimum and maximum price table on your WordPress blog.

When used as a widget it is easy to install, configure and include in your blog’s widgitized sidebar through the WordPress widget control panel. When used through the supplied WordPress shortcode the table can be included anywhere in your blog.

The plugin generates a table with an ID of petrolprices_averages to allow it to be easily styled.

Shortcode

The shortcode [petrolprices] can take two arguments to specify the location to display price data for. Excluding either of these arguments will cause UK wide price data to be displayed.

type
valid values are: postcode, town, county
value
example values: gu124rq, aldershot, hampshire

For example, to include a table showing the fuel prices in Aldershot, the following code could be used:

	[petrolprices type="town" value="aldershot"]

The plugin can be downloaded from its WordPress.org page.

XML Data Feed

We provide a raw data feed for users who want to format their own price data display. The feed provides minimum, maximum and average prices for each type of fuel available in the specified area (or nationally if no area is specified). You must have written permission from PetrolPrices.com to use the XML feed on your site. Failure to get permission from PetrolPrices.com may lead to us removing your feed from your site. Contact [email protected] for more information on our usage policy.

The same variables are available for use with the XML feed as with the Javascript include:

search_type
valid values are: postcode, town, county
search_value
example values: gu124rq, aldershot, hampshire

Calling the XML without a search_type argument will return the average prices for the whole of the UK in the same format.

The feed may be cached if wished, and is updated every 24 hours Monday to Friday at or before 1pm. Therefore, it is recommended that users who choose to cache the data refresh their cache at least once every 24 hours.

http://www.petrolprices.com/feeds/averages.xml

To find out if you can use the XML feed, email [email protected].