| 1 |
#!perl |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
use WWW::Facebook::API; |
| 5 |
|
| 6 |
my $client = WWW::Facebook::API->new( |
| 7 |
desktop => 1, |
| 8 |
throw_errors => 1, |
| 9 |
parse => 0, |
| 10 |
format => 'XML', |
| 11 |
); |
| 12 |
|
| 13 |
print "Enter your public API key: "; |
| 14 |
chomp( my $val = <STDIN> ); |
| 15 |
$client->api_key($val); |
| 16 |
print "Enter your API secret: "; |
| 17 |
chomp($val = <STDIN> ); |
| 18 |
$client->secret($val); |
| 19 |
|
| 20 |
my $token = $client->auth->login( sleep => 20 ); |
| 21 |
$client->auth->get_session( $token ); |
| 22 |
|
| 23 |
use Data::Dumper; |
| 24 |
my $friends_xml = $client->friends->get; |
| 25 |
print Dumper $friends_xml; |
| 26 |
|
| 27 |
my $notifications_xml = $client->notifications->get; |
| 28 |
print Dumper $notifications_xml; |
| 29 |
|
| 30 |
# Current user's quotes |
| 31 |
my $quotes_xml = $client->users->get_info( |
| 32 |
uids => [ $client->session_uid ], |
| 33 |
fields => ['quotes'] |
| 34 |
); |
| 35 |
print Dumper $quotes_xml; |
| 36 |
|
| 37 |
$client->auth->logout; |