wplookup.cgi 593 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/perl
  2. #
  3. # see http://developer.whitepages.com/ for details
  4. #
  5. use Data::Dumper;
  6. use Net::WhitePages;
  7. use CGI qw/:standard/;
  8. my $wp = Net::WhitePages->new(TOKEN => "API_TOKEN");
  9. $caller_id = param('caller_id');
  10. print header("text/plain");
  11. my $res = $wp->reverse_phone(phone => $caller_id);
  12. foreach $entry (@{$res->{listings}}) {
  13. if($entry->{business}) {
  14. print uc("$entry->{business}->{businessname}");
  15. } elsif ($entry->{displayname}) {
  16. print uc("$entry->{displayname}");
  17. } else {
  18. print uc("$entry->{address}->{city}, $entry->{address}->{state}");
  19. }
  20. last;
  21. };