
NAME
Net::Daylife - OOP for the Daylife.com API
SYNOPSIS
use Getopt::Std;
use Net::Daylife;
my %opts = ();
getopts('c:', \%opts);
my $day = Net::Daylife->new('config' => $opts{'c'});
my $res = $day->api_call('search_getRelatedArticles', {'query' => 'flickr'});
foreach my $a ($res->findnodes("/response/payload/article")){
print $a->findvalue("headline") . "\n";
}
DESCRIPTION
Net::Daylife is an OOP wrapper for the Daylife.com API.
Rather than try to mirror the API itself with individual object methods
it exposes one principle method called...you guessed it, *api_call* that
accepts an API method name and its arguments as a hash reference.
API results are returned in a format specific handler. For example, XML
responses are returned as *XML::XPath* objects, JSON responses as
*JSON::Any* objects and so on.
Currently only HTTP level errors are handled. API specific errors are
left to the developer. At some point I may add format specific packages
(Net::Daylife::XML, etc.) at which point it will make more sense to
check response codes automagically.
Wordle is a toy (nifty tool) for generating “word clouds” from text that you provide. The clouds give greater prominence to words that appear more frequently in the source text. You can tweak your clouds with different fonts, layouts, and color schemes.
Wordle also lets you create these "word clouds" using a RSS feed. Sumit Kataria has written a PHP script to generate RSS feeds from DayPIs for any search term you have. Just a perfect fit to use with Wordle!
Here is a RSS feed for Barack Obama - http://develop.daylife.com/demos/feed.php?query=%22Barack%20Obama%22
Feed it to Wordle on http://wordle.net/create and here is what you get
Another RSS feed for "Global Warming" OR "Climate Change" - http://develop.daylife.com/demos/feed.php?query=%22Global%20Warming%22%2...
And here is its Wordle! -
This C# .NET DayPI client is contributed by Tikiri, co-founder and star developer at Chillx.com.
Replace your Accesskey and SharedSecret in the attached code and you are ready to make the DayPI calls from your C# .NET app.
Below is sample code that demonstrates how you can use this library.
The Batch API lets you make multiple DayPI requests as one request to the daylife servers.
You can use this PHP client to make a Batch.parallel request. You can download this script from the attachment below.
Here is sample code how to use this script to first form your DayPI requests and then provide them as request to the Batch API:
I have written a PHP script that generates RSS feeds for articles by calling Daylife's search APIs for any topic, queries, tags or events happening in the world.
Each item in the RSS feeds contains an article headline, description, published time and link to the original source of the article. To produce a desired RSS feed of your interest, you can use the script that I have hosted by forming a URL that looks like:
http://www.buzzingblog.com/dayliferss/rss.php?query=<search term of your choice>
For e.g.,
http://www.buzzingblog.com/dayliferss/feed.php?query=Barack%20Obama
Read more about Daylife's Search query syntax to form your queries intelligently.
http://www.buzzingblog.com/dayliferss/feed.php?query=Barack%20Obama&limit=20
With the availability of RSS feeds on top of the Daylife API, opportunities to build news applications are endless. The script calls the Daylife API on every request and builds the RSS feed in real time. Webmasters can use RSS generator to produce feeds on desired topics to feed them their Drupal/Joomla or any other RSS supported content management systems.
You can download the script and run it on your own server, in case, you want to customize it. You will need to substitute your own accesskey and shared secret that you received from Daylife to make the script work.
The Topic Timeline widget shows coverage of a particular topic in mainstream news and blogs over a period of one month. Every light blue and dark blue bar represents the number of mentions for the topic in news and blogs. You can mouse over the bars to have a closer look on the coverage for that day. The widget also shows an article headline and the article source for each day.
Read more below to understand how to use this widget.
Applications written as Java applets, Flash or Javascript widgets often face security issues where they cannot talk to a data source which does not have the same domain name as the one where they get served from. For example, if you are going to host a flash widget on http://example.com, your flash securtiy settings will normally not let you talk to any data source that is not hosted on http://example.com.
There are workarounds using crossdomain files to solve someo of these problems. However, we do not support a crossdomain file for our freeapi.daylife.com domain that lets your widget read data from anywhere.
To work-around these security issues, you need a proxy that you can host on the same domain as your widget and that proxies all DayPI calls.
Read more below to learn how to use this proxy.
Do you want to put the latest news/blogs from all over the world on your site? On a sidebar? On a search page? On any other page?
We have written a very basic drupal module that gets you news from all over the world using the Daylife News APIs. You can download the drupal module here.
Daylife is an online news aggregator that collects and analyzes news from all over the world and has a set of open APIs (http://cookbook.daylfie.com/docs) for anyone to get news content regarding any topic.
In order to use this news module, you need to sign up for an accesskey and shared secret at http://developer.daylife.com/member/register.
This news module gives you 2 things:
a. A news block that shows headlines about any topic. Once you have installed and enabled the module, you can add an iphone news block with the following PHP code:
<?
$block = daylife_block('view',0, "iphone");
$content = $block['content'];
echo $content;
?>
b. A news search page accessible at /search/daylife/. For e.g. at /search/daylife/iphone for iphone news.
You can get the wikipedia abstracts for topics (people, places and organizations) using a parameter include_wikipedia_info=1 in the API call topic_getInfo.
Wikipedia abstracts give a brief summary about the topic's background and helps the user quickly learn the basic information about the topic. A link to the wiki page for that topic is also returned.
For e.g., wikipedia abstract for Hillary Rodham Clinton below:
This post is an example of how you can write drupal posts displaying a stream of images using our simple PHP client.
This post simply calls the Search APIs to get a list of images for "Olympic Torch" OR "Olympics Torch". If you have image licenses from Getty, AP and/or Reuters, you can get a list of images about any topic in the world using our APIs
.Attached below is the source code for publishing this stream of images about any topic. Please replace your accesskey, shared secret and source_filter_id (provided by us).