#!/usr/bin/perl -w
use WWW::Facebook::API;
use WWW::Facebook::API::Auth;
use WWW::Facebook::API::Canvas;
use HTTP::Request;
use LWP;
use CGI; # load CGI routines
$q = CGI->new; # create new CGI object
print $q->header, # create the HTTP header
$q->start_html('Facebook App'), # start the HTML
$q->h1('Facebook Authentication'), # level 1 header
$q->end_html; # end the HTML
my $facebook_api = '---------------';
my $facebook_secret = '----------------------------';
my $facebook_clientid = '-----------------------------------';
my $client = WWW::Facebook::API->new(
desktop => 0,
api_version => '1.0',
api_key => $facebook_api,
secret => $facebook_secret,
);
$client->app_id($facebook_clientid);
print $q->redirect( $client->get_login_url() );
在 Web 浏览器中显示为
Facebook Authentication
Status: 302 Found Location: http://www.facebook.com/login.php? api_key= - ----------------&v=1.0
如何解决这个 CGI 问题。我在 ubuntu apache 服务器上运行这个 perl 脚本。