Home > Uncategorized > Get #PhantomJSCloud for #Free

Get #PhantomJSCloud for #Free

PhantomJSPhantomJSCloud is a online service, where you can emulate a browser action using a REST API. Great stuff, but unfortunately they charge, and if you’re on a low budget, or you intend to scale too much, then you might be put off by the fees.

However, PhantomJS can be downloaded for free, and it can be run from a asp.net page with no extra permissions set in IIS, and you can customise it to your needs, by making your own web based PhantomJS host with a few lines of code, thanks to NReco.PhantomJS

So, step 1

Install-Package NReco.PhantomJS

Then step 2:

var strUrl = Request.QueryString[“url”];
var strArgs = Request.QueryString[“args”];
if (string.IsNullOrEmpty(strUrl) || string.IsNullOrEmpty(strArgs))
Response.Write(“url and args are required”);
var wc = new WebClient();
var strJS = wc.DownloadString(strUrl);
var phantomJS = new PhantomJS();
phantomJS.OutputReceived += (a, b) =>
phantomJS.RunScript(strJS, new[] { strArgs });

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: