aboutsummaryrefslogtreecommitdiff
path: root/models/openid-php-openid-782224d/examples/discover.php
blob: 31e6b61b7d9d3b12e44d4c785dd9bebfca3499dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php

require_once "consumer/common.php";

require_once "Auth/OpenID/Discover.php";
require_once "Auth/Yadis/Yadis.php";

function getOpenIDIdentifier()
{
    return $_GET['openid_identifier'];
}

function escape($x)
{
    return htmlentities($x);
}


$identifier = getOpenIDIdentifier();
?>
<html>
<head>
<title>OpenID discovery</title>
</head>
<body>
  <h2>OpenID discovery tool</h2>
  <p>
    Enter an OpenID URL to begin discovery:
  </p>
  <form>
  <input type="text" name="openid_identifier" size="40" />
  <input type="submit" value="Begin" />
  </form>
<?
if ($identifier) {

    $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
    list($normalized_identifier, $endpoints) = Auth_OpenID_discover(
        $identifier, $fetcher);

?>
  <h3>Discovery Results for <?= escape($identifier) ?></h3>

  <table cellpadding="7" cellspacing="0">
    <tbody>
      <tr>
        <th>Claimed Identifier</th>
        <td><?= escape($normalized_identifier) ?></td>
      </tr>
<?
if (!$endpoints) {
?>
    <tr>
      <td colspan="2">No OpenID services discovered.</td>
    </tr>
<?
} else {
?>
    <tr>
      <td colspan="2">Discovered OpenID services:</td>
    </tr>
<?
foreach ($endpoints as $endpoint) {
?>
    <tr>
      <td colspan="2"><hr/></td>
    </tr>
    <tr>
      <th>Server URL</th>
      <td><tt><?= escape($endpoint->server_url) ?></tt></td>
    </tr>
    <tr>
      <th>Local ID</th>
      <td><tt><?= escape($endpoint->local_id) ?></tt></td>
    </tr>
    <tr>
      <td colspan="2">
        <h3>Service types:</h3>
        <ul>
<?
foreach ($endpoint->type_uris as $type_uri) {
?>
          <li><tt><?= escape($type_uri) ?></tt></li>
<?
}
?>
        </ul>
      </td>
    </tr>
<?
}
}
?>
  </tbody>
</table>
<?
}
?>
</body>
</html>