Php Larvel:GoogleContactsAPI给出的结果是空的

Php Larvel:GoogleContactsAPI给出的结果是空的,php,laravel,laravel-4,google-api,google-contacts-api,Php,Laravel,Laravel 4,Google Api,Google Contacts Api,我正在尝试使用Laravel4.2+OAuth2。我使用这个包:ardarek-oauth-4-laravel for laravel。这是我的相关文件 问题:无法检索谷歌联系人列表 // Config - app/config/packages/artdarek/oauth-4-laravel/config.php - 'consumers' Google' => array( 'client_id' => '**********', 'client_secret

我正在尝试使用Laravel4.2+OAuth2。我使用这个包:ardarek-oauth-4-laravel for laravel。这是我的相关文件

问题:无法检索谷歌联系人列表

// Config - app/config/packages/artdarek/oauth-4-laravel/config.php - 'consumers'

Google' => array(
    'client_id' => '**********',
    'client_secret' => '*******',
    'scope' => array('https://www.googleapis.com/auth/tasks', 'https://www.google.com/m8/feeds/')
),



// Controller

public function importGoogleContacts() {

    $code = Input::get('code'); // get data from input
    $googleService = OAuth::consumer('Google'); // get google service

    // if code is provided get user data and sign in
    if (!empty($code)) {
        Log::info('authorised');
        // This was a callback request from google, get the token
        $token = $googleService->requestAccessToken($code);

        // Send a request with it
        // $result = json_decode($googleService->request('https://www.googleapis.com/tasks/v1/lists/MDkyOTg5ODc5NDYw/tasks'), true);
        $result = json_decode($googleService->request('https://www.google.com/m8/feeds/contacts/default/full'), true);
        return Response::json($result);
    }
    // if not ask for permission first
    else {
        Log::info('not authorised');
        $url = $googleService->getAuthorizationUri(); // get googleService authorization
        Log::info('URL: ' . $url);
        return Redirect::to((string)$url); // return to google login url
    }
}
我尝试了
userprofile
tasks
api。两者都工作正常-我能够检索
userProfile
信息和
任务列表
。但是,当我尝试联系时,结果是空的。你知道怎么解决这个问题吗?Laravel还有其他套餐吗


提前感谢-Anji

谷歌联系人API默认返回XML,而不像其他谷歌API那样返回JSON。要让它返回JSON,请将
?alt=JSON
附加到URL。

非常感谢。刚刚测试过,效果很好。实际上,我开始使用GoogleAPI PHP客户端而不是这个包。