PHP Web Services Without SOAP
Subject:   Screen shaping
Date:   2003-10-31 05:33:33
From:   anonymous2
If content is output with XHTML and makes wise use of CSS, by definition is makes it ideal for screen shaping.

Whether it is ideal in terms of being a "coarse grained API" is another question (users don't like being flooded with information) - with a REST based API as you've described, there's alot more room to publish a fat API.

That said the advantage of using XHTML, with data clearly defined with id/class attributes, is the provider only needs to build one interface.

Full Threads Newest First

Showing messages 1 through 1 of 1.

  • Adam Trachtenberg photo Screen shaping
    2003-10-31 08:15:23  Adam Trachtenberg | O'Reilly Author [View]

    I have a few thoughts:

    One: There's nothing wrong with using REST and XPath in unison. After you've queried the site with REST, you can make a DOM object, perform some XPath magic, and then then feeding the result set to an XSLT processor. I've recently become a big fan of XPath, as I've started to play with PHP 5's SimpleXML extension, which has integrated XPath query support.

    Two: That article implicitly implies that you have complete control over the input XHTML files. With a published REST interface, there's at least the hint of a promise of a fixed API. If you're screen scraping (regardless of the legalities involved), there's no social contract between you and the site to maintain a working relationship. (i.e. They can redesign their data model at any time and potentially break your scripts.) If a site publishes a REST interface, then you know it's unlikely to shift without warning.

    Three: For your own site, OTOH, you may want to make your REST interface a front-end for an XPath query of your XHTML documents, but that assumes all those documents actually exist as real files on the hard drive or are stored in a XML database. If you're Amazon, you probably don't have millions of individual HTML files; they're probably springing out of some SQL databases into a template, so I don't think that's really an option here.