douiwn6941 2014-10-31 10:31
浏览 18

PHP中检查特定文本的大量远程文件的最快表现方式是什么?

I want to check a list of ~300k webpages if they contain a certain text (e.g. "not available"). This should be done every day.

What would be the best way to do this in PHP?

I can use fread&fopen to read the page line by line, and if a line contains the text, go to the next url.

An other option is to use cURL, which is suppose to be faster than fread, but I'm not sure if it is possible to open a stream and read the page line by line, or that I have to download the whole file and then check it for the text.

Are there other (better) options?

What will perform best on speed?

  • 写回答

1条回答 默认 最新

  • douyou1901 2014-10-31 10:37
    关注

    I have a script that does the similar thing as you mentioned, i found fread more reliable and faster than curl process, especially if the page has media in it. I would recommend fread.

    评论

报告相同问题?

悬赏问题

  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等