Hi,

we are trying to use the Apps Reporting API.

Our script returns this failure message, which is not described within
the documentation:

Failure(2001)ReportTemporarilyNotFound(1066)No extended message
available for this error.

Pls find the script below:

<?
function get_token($gDomain, $gLogin, $gPassword) {
      # working vars
      $host_auth = "www.google.com";
      $service_uri = "/accounts/ClientLogin";
      $vars_auth ="&Email=" . $gLogin . "@" . $gDomain . "&Passwd=" .
$gPassword . "&accountType=HOSTED&service=apps";

      # compose HTTP request header
      $header_auth = "Host: $host_auth\r\n";
      $header_auth .= "Content-Type: application/x-www-form-urlencoded
\r\n";
      $header_auth .= "Content-Length: ".strlen($vars_auth)."\r\n";
      $header_auth .= "Connection: close\r\n\r\n";

      $fp = fsockopen("ssl://".$host_auth, 443, $errno, $errstr);
      if (!$fp) {
            echo "$errstr ($errno)<br/>\n";
            echo $fp;
      } else {
            fputs($fp, "POST $service_uri  HTTP/1.1\r\n");
            fputs($fp, $header_auth.$vars_auth);
            while ($fp && !feof($fp)) {
                  $cString = fgets($fp);
            //echo "$cString<br>";
                  $cStringArray = explode("=", $cString);
                  if ($cStringArray[0] == "SID") {
                        $tok = $cStringArray[1];
                  }
            }
      }
      fclose($fp);
      return $tok;
}

$auth_token = get_token('vaices.de', 'mbulanda', 'n8hunter');
//echo "<p>";//$auth_token = 'AT/2Gh2b34OYD5sWl2c/rhj+';
//echo $auth_token;
//echo "<p>";

$text ="
<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n
<rest xmlns=\"google:accounts:rest:protocol\"\r\n
xmlns:xsi=\" http://www.w3.org/2001/XMLSchema-instance \">\r\n
<type>Report</type>\r\n
<token>$auth_token</token>\r\n
<domain>vaices.de</domain>\r\n
<date>2009-01-19</date>\r\n
<page>1</page>\r\n
<reportType>daily</reportType>\r\n
<reportName>summary</reportName>\r\n
</rest>\r\n
";

      $fp = fsockopen("ssl://www.google.com", 443, $errno, $errstr);
      fputs($fp, "POST /hosted/services/v1.0/reports/ReportingData
HTTP/1.1\r\n");
      fputs($fp, "Host: www.google.de\r\n");
      fputs($fp, "content-type: text/xml\r\n");
      fputs($fp, "Content-Length: ".strlen($text)."\r\n");
      fputs($fp, "Connection: close\r\n\r\n");

      fputs($fp, $text);

      while ($fp && !feof($fp)) {
        $res = fgets($fp);
      echo "$res<br>";
      }

?>

It is no auth problem, since auth is working fine.

Thank you and best regards

Ruben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to