RSS feed for invoices
Using the Glesys API, you can get an RSS feed for your invoices.
<?php
$account = "cl12345";
$apikey = "secret";
$invoicesJson = file_get_contents("https://$account:$apikey@api.glesys.com/invoice/list/format/json");
$invoices = json_decode($invoicesJson, true);
?>
<?xml version='1.0' encoding='UTF-8'>
<rss version="2.0">
<channel>
<title>GleSYS invoices</title>
<description>A list of all invoices for the account <?=$account?></description>
<link>http://www.glesys.se/</link>
<lastbuilddate>
<?php
$timestamp = strtotime($invoices['response']['invoices'][0]['invoicedate']);
$rss_datetime = date(DATE_RFC2822, $timestamp);
print $rss_datetime;
?>
</lastbuilddate>
<pubdate>Mon, 19 Dec 2011 08:45:00 +0000</pubdate>
<ttl>1800</ttl>
<?php foreach($invoices['response']['invoices'] as $invoice): ?>
<item>
<title>Invoice <?=$invoice['invoicenumber']?></title>
<description>
Due date: <?=$invoice['duedate']?>
Amount: <?=$invoice['total']?> <?=$invoice['currency']?>
</description>
<link><?=htmlentities($invoice['url'])?></link>
<guid><?=htmlentities($invoice['url'])?></guid>
<pubdate>
<?php
$timestamp = strtotime($invoice['invoicedate']);
$rss_datetime = date(DATE_RFC2822, $timestamp);
print $rss_datetime;
?>
</pubdate>
</item>
<?php endforeach; ?>
</channel>
</rss>PreviousLoad balancing and failover using the Glesys APINextGetting started with Terraform in Glesys Cloud
Last updated
Was this helpful?