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?