Skip to content
Browse files

Changed the example code.

  • Loading branch information...
1 parent 844bfd8 commit 1df87afe1075eb3aafc56b8590bd8ecf741ac46a Bruno Pedro committed Dec 15, 2010
Showing with 29 additions and 14 deletions.
  1. +29 −14 endpoint.php
View
43 endpoint.php
@@ -1,17 +1,32 @@
<?php
-require 'Superfeedr.php';
+require_once 'Superfeedr.php';
-$s = new Superfeedr;
+$username = 'XXXXXXXXXX'; // your superfeedr username
+$password = 'XXXXXXXXXX'; // your superfeedr password
+$callback = 'http//XXXX'; // your callback URL
-switch($_GET['hub_mode']) {
- case 'subscribe':
- case 'unsubscribe':
- $s->verify();
- break;
-
- default:
- if($s->callback() and $entries = $s->parse_entries($s->request)) {
- // $entries is an array
- }
- break;
-}
+/**
+ * Example feed.
+ *
+ * Go to http://pubsubhubbub-example-app.appspot.com to update it.
+ */
+$feed = 'http://pubsubhubbub-example-app.appspot.com/feed';
+
+$superfeedr = new Superfeedr($username, $password, $callback);
+
+//
+// Is it a verification callback?
+//
+if (!$res = $superfeedr->verify()) {
+ //
+ // It must be a regular callback, with content.
+ //
+ $json = $superfeedr->callback();
+
+ //
+ // Dump the content to a file.
+ //
+ file_put_contents('result.txt', print_r($json, true) . "\n", FILE_APPEND);
+}
+
+?>

0 comments on commit 1df87af

Please sign in to comment.
Something went wrong with that request. Please try again.