不能让google从joomla站点请求http


Can't make google http request from joomla site

我正在用Google Analytics API做一些实验,它进展得很好(现在只是跟着他们的Hello Analytics教程)。代码运行良好,直到我在我的旧虚拟域上运行它,但是当我试图从我目前正在开发的网站(使用joomla)做它时,我得到了http请求的问题。

我给用户一个链接到谷歌,在那里我可以选择谷歌帐户和授予访问GA等,当它重定向到我的网站,我什么也得不到。它加载了一段时间,然后把我送到我的网站404页。

我的代码看起来像这样(它在组件视图中的default.php中。我去掉了定义的(j_exec)或die()用于测试目的):

<?php

require_once 'libraries/google-api-php-client/src/Google_Client.php';
require_once 'libraries/google-api-php-client/src/contrib/Google_AnalyticsService.php';
require_once 'libraries/google-api-php-client/src/contrib/Google_PlusService.php';
$session = JFactory::getSession();
$client = new Google_Client(); 
//$client->setAccessType('online');
$client->setApplicationName('sdffdgdfg');
$client->setClientId('my id ;)');
$client->setClientSecret('dsfdsf');
$client->setRedirectUri('asdsdf');
$client->setDeveloperKey('fdfg');
$client->setScopes('https://www.googleapis.com/auth/analytics.readonly');
// Set the client libraries to convert all the API responses from associative arrays into objects.
$client->setUseObjects(true);

//$plus = new Google_PlusService($client);
if( isset( $_GET['code'] ) ){
    $client->authenticate($_GET['code'] );
    $session->set('token', $client->getAccessToken());
    //i took away the redirect here cuz i wanted to see that the code actually came :)

}
$token = $session->get('token');
if( isset( $token ) ){
    $client->setAccessToken($session->get('token'));

}
if( !$client->getAccessToken() ){
    $authUrl = $client->createAuthUrl();
    print "<a class ='login' href='$authUrl'>Connect me!</a>";
}else{
    echo "WE'RE IN!!";
    //$analytics = new apiAnalyticsService($client);
    //runMainDemo($analytics);
}

?>

问题停止如果我注释行$client->authenticate($_GET['code']);所以我沿着这条线索最后来到了

一行
$request = Google_Client::$io->makeRequest(new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), array(
          'code' => $code,
          'grant_type' => 'authorization_code',
          'redirect_uri' => $this->redirectUri,
          'client_id' => $this->clientId,
          'client_secret' => $this->clientSecret
      )));

这行位于Google_OAuth2.php第96行。所以请求出了问题,就会超时。我该怎么办呢?这几乎是我自己解决问题所需要的,所以我真的需要一些帮助!会不会和乔姆拉有关?还是我的服务器配置?(和我的虚拟域名不一样…)

提前感谢!!

我忘了说这个已经解决了。我发邮件给我的服务器供应商之前,他们告诉我,他们与此无关。然后我又给他们发了一封电子邮件(大概是在发帖两周后),他们说我的防火墙关闭了。他们一打开门,我就进去了。