2012-12-15 63 views
1

我想驗證域名是否爲google文檔範圍。這是網址:Google Apps Auth with edu.au域名

https://www.google.com/accounts/AuthSubRequest?next=http%3A%2F%2Fwww.mydomain.edu.au%2Fcomponents%2Fgoogle%2FretrieveToken.php&scope=https%3A%2F%2Fdocs.google.com%2Ffeeds%2F&session=1&secure=0&hd=default

所以我的域名是:www.mydomain.edu.au

但隨後makng請求時,我得到這樣的回答:

The page you have requested cannot be displayed. Another site was requesting access to your Google Account, but sent a malformed request. Please contact the site that you were trying to use when you received this message to inform them of the error. A detailed error message follows: 
The site "http://edu.au" has not been registered. 

所以其確定爲edu.au域名。

有沒有辦法解決這個問題?

感謝名單

樣本上傳文件到Google文檔代碼:

public static function uploadDocs($data = array()) 
{ 
    if (!self::checkInput($data)) return false; 
    $data['url'] = Google::docsAPIUrl.'default/private/full'.self::getFolder($data['folderId']); 
    //"?convert=false" 
    $headers = Google::getAuthToken(); 
    array_push($headers, Google::getGData()); 
    $contentHeaders = self::getInputHeaders($data); 
    array_push($headers, 'Content-Length: '.$contentHeaders['length']); 
    array_push($headers, 'Content-Type: '.$contentHeaders['type']); 
    array_push($headers, 'Slug: '.Html::win2utf8($data['docTitle'])); 
    if ($data['inputMethod'] == 'File') 
    { 
     $data['input'] = ((fread(fopen($data['input'], 'rb'), filesize($data['input'])))); 
    } 
    $curl = Google::curl($data['url'], null, $data['input'], $headers); 
    if (Curl::checkCode($curl['code'])) 
    { 
     return self::parseNewXML($curl['response']); 
    } 
    else 
    { 
     Google::$error = array('errorCode'=>$curl['code'],'errorString'=>$curl['response']); 
     return false; 
    } 
} 
+0

你能提供更多關於你實際上想要在這裏做什麼的細節嗎?最終目標是... –

+0

我的最終目標是通過谷歌文檔生成PDF並下載到服務器。 – BlueZero

回答

0

的AuthSub已棄用。您應該使用OAuth 2.0Drive API v2

+0

我不想花時間開發新功能,如果我不必。 AuthSub仍然有效。 – BlueZero

+0

你使用的是什麼API(和API的版本)?你的代碼是否曾經工作過,現在已停止工作或者正在開發新的東西?你的代碼是什麼樣的? –

+0

我做了一個處理谷歌應用程序請求的組件。它適用於每個範圍都不同的AuthSubSessionToken。對於我的新應用/網絡,我只需要google文檔的令牌。代碼是OOP。似乎我不能粘貼在這裏...所以我已經添加了一個原始Q的功能。 – BlueZero

相關問題