SitePoint PHP Blog: Powerful Custom Entities with the Diffbot PHP Client

来源:转载

On the SitePoint PHP blog editor Bruno Skvorccontinues his look at the Diffbotservice and shows how to use their API to create entities representing objectsfrom the API data.

A while back, we looked at Diffbot, the machine learning AI for processing web pages, as a means to extract SitePoint author portfolios. [...] Since then, the design of the pages we processed has changed, and thus the API no longer reliably works. In this tutorial, apart from rebuilding the API so that it works again, we’ll use the official Diffbot client to build custom entities that correspond to the data we seek (author portfolios).

He starts by setting up the environment for development (a Homestead Improved instance) and pulling in a few libraries to bootstrap the script. He shows the setup and configuration of the Diffbot client, creating a new API application via their UI and using the browser tools to help the service locate the information it needs. He then shows how to extend the client and define an "entity factory" to generate the objects requested. In this case he creates an AuthorFolioclass to contain the author's number of posts.



分享给朋友:
您可能感兴趣的文章:
随机阅读:
栏目列表
推荐内容