Custom POST Data, Referer and Cookie

Browshot has some unique features that makes it a good tool to track advertising on websites. We have a couple of customers who use Browshot to monitor ads on their own website.

Browshot can show the list of files (Javascript, iframes, images, Flash, etc.) contained on a page. You can use Browshot to take screenshots at regular intervals and check what ad was running at the time. Browshot act as a neutral third party to prove to the advertisers that their ads were running.

You can use Browshot as part of your own ad monitoring system. But you can also let us handle everything. For example, one of our customer sends us a list of Ad files included on their site. We make screenshots hourly on his behalf and we map ads to a specific screenshots. At the end of the month he can download an archive of all the screenshots with the required information. They can show their advertiser a screenshot of their website with their ad running.

Don't hesitate to contact us for any custom project.


Custom POST Data:

You can customize the request which is sent to the target page for the screenshot. You can include any POST Data, like you were sending a form. This pages shows hot to use the feature from Browshot.

For example, let us say you would like to take a screenshot of your Browshot dashboard at "https://browshot.com/dashboard". In order to access this page, you must be logged in. To login, you can fill out the form at "https://browshot.com/login" with your username and password, and you will be redirected to your dashboard. Browshot support redirections, so this is fine.

Let us say your username is foo and password is bar. You need to pass this value to post_data:

username=foo&password=bar

If you use any of the Browshot libraries, you do not need to worry about encoding data:

$browshot->create_screenshot(url => 'https://browshot.com/login', post_data => 'username=foo&password=bar'); # Full API
$browshot->simple(url => 'https://browshot.com/login', post_data => 'username=foo&password=bar'); # Simple API
client.screenshot_create('https://browshot.com/login', { 'post_data' => 'username=foo&password=bar' }); # Full API
client.simple('https://browshot.com/login', { 'post_data' => 'username=foo&password=bar' }); # Simple API

If you prefer to use the command line to get a screenshot, you need to take care of encoding the post_data value correctly: & becomes %26, = becomes %3d, etc.:

wget "https://api.browshot.com/api/v1/simple?url=https://browshot.com/login&post_data=username%3dfoo%26password%3dbar&key=my_api_key" -O /tmp/dashboard.png


Custom Referer:

Similarly, you can define a custom Referer header. Some websites display different content if the user comes from a search engine, or redirect users to the home page is they do not come from the same site.

Like for the post_data parameter, you need to encode the Referer URL if you use the command line.

If you want to simulate a request by a user coming from a Google search for "test screenshot", you can use the Refer http://www.google.com/?q=test+screeenshot. Using wget, it looks like this:

wget "https://api.browshot.com/api/v1/simple?url=http://website.com/&referer=http://www.google.com/%3Fq%3Dtest%2Bscreeenshot&key=my_api_key" -O /tmp/search.png


Custom Cookie:

You can use a custom cookie string, for example to reuse an existing session. The cookie is set for the URL of the target site.

The cookie string can contain several key=value pairs.

Like for the post_data and referer parameters, you need to encode the cookie string if you use the command line.

Try it for free

close

sign up for free account

Already have an account?

no credit card required

About Us

Browshot is a web service to create real time web screenshots in a multitude of virtual devices, including mobile devices like the iPhone 3 & 4, iPad, Android Nexus, etc.

You can use the web dashboard, or our full-featured API.

  • Real time screenshots

  • 15+ mobile devices: iPhone, iPad, Android, etc.

  • 30+ desktop resolutions

  • Fast and reliable

  • Thumbnails of any size, any ratio

  • Full API, open-source libraries

Share