Can you please help me to solve the following problem.
I am running a script to authenticate client from google and then i got the following error
Resource id #4
HTTP/1.0 302 Moved Temporarily Content-Type: text/html; charset=UTF-8 Location: https://www.google.com/accounts/ClientLogin Content-Length: 225 Date: Wed, 10 Nov 2010 06:33:40 GMT Expires: Wed, 10 Nov 2010 06:33:40 GMT Cache-Control: private, max-age=0 X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Server: GSE
Moved Temporarily
The document has moved here.
0Array ( [authToken] => [error] => No Error )
u can have a look of this error here
http://iphoneappcompany.com/fan_connect/test-c2dm.php
Actually i am trying to use c2dm- cloud to device messaging on my android application
here is the script
$host = ‘www.google.com’;
$usepath = ‘/accounts/ClientLogin’;
// open socket to filehandle(epdq encryption cgi)
$fp = fsockopen( $host, 80, &$errno, &$errstr, 60 );
//check that the socket has been opened successfully
if( !$fp ) {
$returnArr = array();
$returnArr['authToken']=0;
$returnArr['error'] = "$errstr ($errno)";
} else {
$params = "accountType=HOSTED_OR_GOOGLE&Email=myemail&Passwd=mypassword&service=c2dm&source=appsource";
//write the data to the request
fputs( $fp, "POST $usepath HTTP/1.0\n");
$strlength = strlen( $params );
fputs( $fp, "Content-type: application/x-www-form-urlencoded\n" );
fputs( $fp, "Content-length: ".$strlength."\n\n" );
fputs( $fp, $params."\n\n" );
//clear the response data
$output = "";
//read the response from the remote cgi
//while content exists, keep retrieving document in 1K chunks
while( !feof( $fp ) ) {
$output .= fgets( $fp, 1024);
}
echo $fp.”
“;
echo $output.”
“;
$returnArr = array();
if(contains("Error=", $output)){
$error = strstr($str, 'Error=');
$final_error = "";
if(contains("BadAuthentication", $output)){
$final_error = "BadAuthentication - The login request used a username or password that is not recognized.";
}else if(contains("NotVerified", $output)){
$final_error = "NotVerified - The account email address has not been verified. The user will need to access their Google account directly to resolve the issue before logging in using a non-Google application. ";
}else if(contains("TermsNotAgreed", $output)){
$final_error = "TermsNotAgreed - The user has not agreed to terms. The user will need to access their Google account directly to resolve the issue before logging in using a non-Google application. ";
}else if(contains("CaptchaRequired", $output)){
$final_error = "CaptchaRequired - A CAPTCHA is required. (A response with this error code will also contain an image URL and a CAPTCHA token.)";
}else if(contains("Unknown", $output)){
$final_error = "Unknown - The error is unknown or unspecified; the request contained invalid input or was malformed.";
}else if(contains("AccountDeleted", $output)){
$final_error = "AccountDeleted - The user account has been deleted.";
}else if(contains("AccountDisabled", $output)){
$final_error = "AccountDisabled - The user account has been disabled.";
}else if(contains("ServiceDisabled", $output)){
$final_error = "ServiceDisabled - The user's access to the specified service has been disabled. (The user account may still be valid.)";
}else if(contains("ServiceUnavailable", $output)){
$final_error = "ServiceUnavailable - The service is not available; try again later.";
}
$returnArr['authToken']=0;
$returnArr['error'] = $final_error;
}else{
// we have an authToken
$toeknString = strstr($str, 'Auth=');
$token = substr($toeknString, 5);
setAuthToken($token);
$returnArr['authToken']= $token;
$returnArr['error'] = "No Error";
}
}
print_r($returnArr);
return $returnArr;
HTTP 302 is not and error.
It says the page you’r trying to reach has been moved.
Actually, it is just used to redirect the browser in websites.
In your case, you have to follow the redirection given by
Location: https://www.google.com/accounts/ClientLogin.I bet you will have to store cookies from your first request so that the page you are redirected to can serve you content according to your login.