summaryrefslogtreecommitdiffstats
path: root/examples/consumer/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'examples/consumer/common.php')
-rw-r--r--examples/consumer/common.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/consumer/common.php b/examples/consumer/common.php
new file mode 100644
index 0000000..81ec864
--- /dev/null
+++ b/examples/consumer/common.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Require the OpenID consumer code.
+ */
+require_once "Auth/OpenID/Consumer/Consumer.php";
+
+/**
+ * Require the "file store" module, which we'll need to store OpenID
+ * information.
+ */
+require_once "Auth/OpenID/Store/FileStore.php";
+
+/**
+ * This is where the example will store its OpenID information. You
+ * should change this path if you want the example store to be created
+ * elsewhere. After you're done playing with the example script,
+ * you'll have to remove this directory manually.
+ */
+$store_path = "/tmp/_php_consumer_test";
+
+if (!file_exists($store_path) &&
+ !mkdir($store_path)) {
+ print "Could not create the FileStore directory '$store_path'. ".
+ " Please check the effective permissions.";
+ exit(0);
+}
+
+$store = new Auth_OpenID_FileStore($store_path);
+
+/**
+ * Create a consumer object using the store object created earlier.
+ */
+$consumer = new Auth_OpenID_Consumer($store);
+
+?> \ No newline at end of file