php - Installing PhantomJS on server -
i'm using phantomjs on windows , accessing files through command line. want install on server i'm working on local host want installed on apache, may integrate phantom html , php used within web page. i'm using windows 8.1 , apache server localhost.
can that? how use in web services now? how use if have make web online? should have t ask hosting provider place thing on server me?
i'm using phantomjs develop web service takes url input , returns image file of screen shot of website.
the "installation" of phantomjs adding path path environment variable.
running through php
since you're using php, invoke phantomjs php script shown here need provide full path phantomjs executable. can use putenv
extend path directly php seen here.
can return phantomjs script in $output
variable of exec
, parse it.
running through webserver module
phantomjs provides web server module. can write script listens requests, creates page
on request , returns image. somehow run script @ startup or apache. it's possible write wrapper can run windows service. may possible pass requests through apache phantomjs not open outside.
although option little treacherous, because phantomjs may fail , need kind of reviving mechanism. script may run memory leak.
returning image
both of above options agnostic how return image. there several possiblities.
- on request, create random , unique filename ,
render
page file. can send name of file client might request afterwards. needs 2 requests. - on request, render page through
renderbase64
receive plain image data. can send image data directly in response , client may put dom viadata:
-uri.
Comments
Post a Comment