array( 'method'=> 'POST', 'header'=> implode("\r\n", array( 'Content-type: application/x-www-form-urlencoded', 'Accept: application/xrds+xml, */*' )), 'content' => http_build_query($params, '', '&') ))); $response = file_get_contents('https://www.google.com/accounts/o8/ud', false, $context); $identity = $_GET['openid_identity']; return array(strpos($response, 'is_valid:true') !== false, $identity); } function mozilla_validate($token) { if (! ini_get('allow_url_fopen')) { die('You must have "allow_url_fopen=On" to use this feature!'); } $params = array( 'assertion' => $token, 'audience' => (isset($_SERVER['HTTPS']) ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'] ); $context = stream_context_create(array( 'http'=> array( 'method'=> 'POST', 'header'=> implode("\r\n", array( 'Content-type: application/x-www-form-urlencoded', )), 'content' => http_build_query($params, '', '&') ))); $body = @file_get_contents('https://verifier.login.persona.org/verify', false, $context); $response = json_decode($body, true); if (! $response) { return array( false, '' ); } return array( $response['status'] === 'okay', $response['email'] ); }