PHP + PhantomJS Rasterize

前端 未结 1 467
后悔当初
后悔当初 2021-01-22 23:19

I\'m using PhantomJS 64 bit in my PHP application to dynamically capture an HTML page to be emailed to the user.

phantomjs rasterize.js \"http://...\" /path_to_i         


        
相关标签:
1条回答
  • 2021-01-22 23:34

    UPDATE: This great article by Arlo Carreon points out how to make this work on HostGator shared hosting (this was my problem). Simply add 2>&1 at the end of the command to redirect the output. The 64 bit version still does not work but this fixes the 32 bit version.

    It turns out that this only happens when the PHP script is requested through the Apache web server. The workaround is to create a database entry for users that need to receive the email and setup a cron to execute the PHP script that calls PhantomJS for each user entry in the DB. When the cron is set to run at the smallest interval the user perceives that the email was generated and sent immediately.

    0 讨论(0)
提交回复
热议问题