Skip to content

Commit

Permalink
Fix example code.
Browse files Browse the repository at this point in the history
  • Loading branch information
themel committed May 18, 2015
1 parent d9543e1 commit a2a4db6
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ It was written by Josh Fraser (joshfraser.com) and is released under the Apache
# Usage

```php
// specify which hub you want to use. in this case we'll use the demo hub on app engine.
$hub_url = "http://pubsubhubbub.appspot.com/";

// create a new pubsubhubbub publisher
$p = new Publisher($hub_url);

// specify the feed that has been updated
$topic_url = "http://www.onlineaspect.com";

// notify the hub that the specified topic_url (ATOM feed) has been updated
// alternatively, publish_update() also accepts an array of topic urls
if ($p->publish_update($topic_url)) {
    echo "$topic_url was successfully published to $hub_url";
} else {
    echo "Ooops...";
    print_r($p->last_response());
}
include("subscriber.php");

$hub_url = "http://pubsubhubbub.appspot.com";
$callback_url = "put your own endpoint here";

$feed = "http://feeds.feedburner.com/onlineaspect";

// create a new subscriber
$s = new Subscriber($hub_url, $callback_url);

// subscribe to a feed
$s->subscribe($feed);

// unsubscribe from a feed
$s->unsubscribe($feed);
```

0 comments on commit a2a4db6

Please sign in to comment.