dongzhi6382 2014-04-24 17:22
浏览 37
已采纳

从php页面运行后台ruby脚本[关闭]

So I have two ruby scripts that scrape two websites for information based on what it entered via a form. Basically, the form outputs to a file, and the two ruby scripts take their input from that file and proceed to scrape and return a viewable html file. My problem is that I have no idea how to connect the php file to the ruby scripts. When I was writing them, I just tested them via the terminal to ensure they worked correctly. Now that I have everything done, I am lost when it comes how to actually execute the scripts from the php file that writes the user input to file.

  • 写回答

1条回答 默认 最新

  • douque9982 2014-04-24 17:29
    关注

    You should write a poller in the ruby script that checks the file you write from PHP periodically. There is an issue of concurrency when you are trying to do this: the producer could be writing at the same time the consumer is reading.

    I suggest to read and write to DB, so you don't have to worry about it. If you don't want to setup a fully professional DB, you can use SQLite (ruby PHP).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭