Created
September 11, 2012 10:02
-
-
Save delphinus/3697356 to your computer and use it in GitHub Desktop.
Woopra API sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use Date::Manip; | |
| use LWP::Simple; | |
| use JSON; | |
| use YAML; | |
| use URI; | |
| my $uri = URI->new('http://api.woopra.com/rest/analytics/get.jsp'); | |
| $uri->query_form( | |
| website => 'blog.remora.cx', | |
| api_key => 'SWUKTD19Y1', | |
| format => 'json', | |
| date_format => 'yyyy/MM/dd', | |
| start_day => UnixDate('-30 days', '%Y/%m/%d'), | |
| end_day => UnixDate(now => '%Y/%m/%d'), | |
| query => q!SELECT visits.count FROM cloud GROUP BY 'info.browser'!, | |
| ); | |
| print $uri->as_string; | |
| my $result = get $uri->as_string; | |
| my $json = from_json($result); | |
| print Dump $json; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment