1

First a summary of the question before going into detail: Is it possible to send a (cors)request to an external dedicated server running phantomjs/casperjs which in return makes a screenshot of the requested url and send the screenshot back?

details on situation: Used to code alot in the eighties when I was still very young. Only started taking on PHP and jquery 2 months ago and my first practice project resulted in an icon generator @ www.iconoplastix.com. Although the outcome looks good I still dont know jackshizzle about anything.

It only features export to html/css since it seemed rather difficult/impossible to make screenshots serverside (to render icons to image).

Now that version1.0 is online I can concentrate on getting exporting icons to image working but I don't know if what I want to establish is even possible.

What did I do so far:

  • subscribed for a cloud vps dedicated server
  • installed phantomjs on this server
  • have been fiddling with making cors requests between xampp at my own system and where the icongenerator is located (externally, shared hosting) with success.

What I am aiming for is that once a user wants to export his icons to image on the first website (where the icongenerator is at) it creates a folder with just a html file showing a range of icons. Then this website should send a signal (corsrequest?) to my vps cloud with phantomjs running. The message/request should contain the url where the screenshot has to be taken (md5 made folder). On this (cors)request phantomjs (and casperjs) should take a screenshot of this url and send it back to website the request came from. Is this possible and if so, could someone shed some light in my darkness since I dont have a clue where to go from here.

I have read alot of documentation on phantonjs and a bit of casperjs but I cant find anywhere (correct me if im wrong) if it is possible to call phantomjs/casperjs from within a webpage. If this is not possible how would the approach to my problem be?

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
  • Can you please make it clearer of what you want to make the screenshot (I think the icon?), where should it go (you say a folder, but on what system) and how exactly the communication should be? It doesn't help when you use signal/message/request/corsrequest for the same thing. Just stick to one of them and edit your question. Also, do you want to take image screenshots (png, jpg) or pdf? – Artjom B. Nov 26 '14 at 07:29
  • I need a screenshot of my own website(primary site) taken from external server with phantomjs(secondary site). webshot in .png format. The folder where the temporary index.html is in (primary site), is a random number so I have to somehow send that url to the external server (secondary site where phantomjs is running). after that the screenshot has to be send from the external server back to the primary website. I just don't know how to activate/fire "phantomjs filename.js" (normally via command prompt) after the external request from external primary site has been made. – Sven Wesseling Nov 26 '14 at 12:14
  • What makes this question very broad (too broad?) is that you don't specify what server environment you want to use. I have [here](http://stackoverflow.com/a/26910336/1816580) an answer which might work for you. I actually wrote an answer and only then remembering that I have written something like that already. – Artjom B. Nov 27 '14 at 17:39
  • Im only realising now that the question is idd too broad. it contains more then one issues at once. the link proves very useful information though. thnx alot! – Sven Wesseling Nov 28 '14 at 19:34

0 Answers0