Updated the meta-detector library (v0.2)

I updated the meta-decector library..

To check out how it works, here's the updated code. (now with nifty comments).

  1. <?php
  2.  
  3. // Inlude the parser
  4. require_once 'Sabre/Web/MetaParser.php';
  5.  
  6. // Change this url
  7. $url = "http://www.rooftopsolutions.nl"
  8.  
  9. // Create an instance
  10. $parser = new Sabre_Web_MetaParser($url);
  11.  
  12. // Explicitly ask to locate and parse the RSD
  13. $parser->setFindRSD(true);
  14.  
  15. // Start making the calls and return the outcome
  16. $sitemeta = $parser->exec();
  17.  
  18. //Open a try..catch block
  19. try {
  20.  
  21. // Dump the results on screen
  22. // This is simular to the demo on http://www.rooftopsolutions.nl/blogdetect
  23.  
  24. echo '<pre>';
  25. print_r($sitemeta);
  26.  
  27. } catch {Exception $e) {
  28.  
  29. echo('Something bad happened: ' . $e->getMessage());
  30.  
  31. }
  32.  
  33. /*
  34. As you can see there's a code for the different feed and api types..
  35. you can try comparing those with the different constants:
  36.  
  37.   Sabre_Web_Blogging::ATOM
  38.   Sabre_Web_Blogging::MOVABLETYPE
  39.   Sabre_Web_Blogging::BLOGGER
  40.   Sabre_Web_Blogging::METAWL
  41.  
  42. and
  43.  
  44.   Sabre_Web_Feed::RSS19
  45.   Sabre_Web_Feed::RSS20
  46.   Sabre_Web_Feed::ATOM
  47.   Sabre_Web_Feed::RDF
  48.  
  49. */
  50.  
  51. ?>

The changelog (warning: dry)

  • Sabre_HTTP_Request now throws more usefull exceptions.
  • Sabre_Web_MetaParser now returns integers for the RSS feed types and API types.
  • Moved RSD code from Sabre_Web_MetaParser to to Sabre_Web_RSDParser.
  • Fixed bugs related to some relative url's

0 Responses to Updated the meta-detector library (v0.2)

  1. There are currently no comments.

Leave a Reply



About

My name is Evert, and I've been writing semi-regularly on this blog since 2006.

I'm currently available for contract work.

more info.

Subscribe

Dropbox

Dropbox is a simple cross-platform online backup and sync application. The first 2GB of space is free, and both you and me get an extra 250MB extra space if you sign up through this link.