开发者

Ways to include a scraped table into another page

开发者 https://www.devze.com 2022-12-15 11:28 出处:网络
I\'ve coded a PHP script that scrapes a publicly available data table. The data changes every 5 min. My script whenever called will scrape the data using htmlsimpledom and returns me the table in HTML

I've coded a PHP script that scrapes a publicly available data table. The data changes every 5 min. My script whenever called will scrape the data using htmlsimpledom and returns me the table in HTML table format. I now want to include this result 开发者_JS百科returned by the script into a wordpress page, so that every time I visit the WP page, the script gets called and I see the latest table.

How do I go about this? Can I just create a new WP page and add my script between PHP tags in the page?

Thanks


I'd say yes. The preferred way would be to write a plugin for it though and then use a custom template tag, instead of plastering the code into the template itself. This way it would be reusable on multiple pages.

0

精彩评论

暂无评论...
验证码 换一张
取 消