+try {
+ $feedurl = $discover->discoverFromURL($oprofile->uri);
+ $salmonuri = $discover->getAtomLink(Salmon::REL_SALMON)
+ ?: $discover->getAtomLink(Salmon::NS_REPLIES); // NS_REPLIES is deprecated
+ if (empty($salmonuri) ) {
+ throw new FeedSubNoSalmonException('No salmon upstream URI was found');
+ }
+} catch (FeedSubException $e) {
+ $acct = $oprofile->localProfile()->getAcctUri();
+ print "Could not discover feeds HTML response, trying reconstructed acct URI: {$acct}\n";
+ $disco = new Discovery();
+ $xrd = $disco->lookup($acct);
+ $hints = DiscoveryHints::fromXRD($xrd);
+
+ if (empty($feedurl) && !array_key_exists('feedurl', $hints)) {
+ throw new FeedSubNoFeedException($acct);
+ }
+ $feedurl = $feedurl ?: $hints['feedurl'];
+ $salmonuri = array_key_exists('salmon', $hints) ? $hints['salmon'] : $salmonuri;
+
+ // get the hub data too and put it in the FeedDiscovery object
+ $discover->discoverFromFeedUrl($feedurl);
+}
+