简体   繁体   English

从PHP URL读取表中的数据并将其写入文本文件

[英]Read the data in table from a PHP URL and write it to a text file

We have a local site written in PHP, which contains some data in table format (index.php). 我们有一个用PHP编写的本地站点,其中包含一些表格式的数据(index.php)。 It is a dynamically generated data/table, so I'm not able to access the database behind it. 它是动态生成的数据/表,因此我无法访问其后面的数据库。

Is there any way I can read the table in that web page, and write it to a text file in the same table format using perl/php/python? 有什么方法可以读取该网页中的表格,然后使用perl / php / python以相同的表格格式将其写入文本文件?

The table is a huge one with around 1000 rows. 该表是一个巨大的表,大约有1000行。 But I need only the top 10 rows (sorted based on one of the columns). 但是我只需要前10行(根据其中一列排序)。

Please help. 请帮忙。

在PHP中,可以使用file_get_contents()函数获取任何页面的整个html,然后可以使用fopen()和fwrite()过滤所需的内容并将其保存在文本文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM