This is probably a very basic question. I would like to run a headless browser PhantomJS as a server but not as a command line tool.
Once it is running
The easiest way is to make a python script or something simple to start the server and use python websockets to communicate with it, using a web form of sorts to query for a website and get the page source. Any automation can be done via cron jobs, or if you are on Windows, you may use the Tasks feature to autostart the python script.