I would like to have a "Facebook style link commment" feature in Drupal 7. When you enter a URL it will pull the page title, first 100 characters of the main website text and an image. There is a module called "Facebook Style Micropublisher" but it's Drupal 6 only. Any other ideas on how this could get accomplished?

  • Will you be entering the url in a new node? – Matthew Hui Jun 6 '11 at 5:14
  • I would enter the URL and the parsed info into fields. Over the weekend I stumbled across oembed.com (an open format to embed content) and embed.ly (a commercial site). There is even a module that seems to support both: drupal.org/project/oembed. – uwe Jun 7 '11 at 0:56

The manual way to do it is to create a custom module that uses drupal_http_request to download the remote URL, then parse through the resulting data to pull out any images, a summary, and the contents of the title tag.

This is a lot harder than it sounds because manually parsing HTML is actually pretty tricky. If you must take this approach, try using simplexml or a library that tries to simplify things for you.

A better approach might be just porting the Drupal 6 module yourself - it's probably less work and you could contribute your code back and possibly get patches from other contributors.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.