Browsers


Request Browser

This API endpoint is used to request a browser. URL_Type should be set to either 'local' or 'remote.' Local scripts are hosted on BrowserBucket.com, whereas remote scripts are hosted on an external server of your choosing. If you're using a local script URL_Data should be set to the desired script's ID. If you're using a remote script URL_Data should be set to the URL Address of the remote script. If Persists is set to true, the script will be reattached everytime the browser reloads, such as when it navigates to a new webpage.

<?php

print_r(sendRequest("GET", "RequestBrowser", "&CloseAfter=15&URL_Type=remote&URL_Data=" . urlencode("http://www.browserbucket.com/remote.php") . "&Persists=false"));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}


var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&CloseAfter={value}&URL_Type={value}&URL_Data={value}&Persists={value}";

var url = 'https://api.browserbucket.com/RequestBrowser/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Get Browsers

This API endpoint returns information about all the active browser instances currently running on a users account.

<?php

print_r(sendRequest("GET", "GetBrowsers", ""));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}



var authdata = "?Token={token}&UserID={userid}";

var url = 'https://api.browserbucket.com/GetBrowsers/'+ authdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Get Browser Info

This API endpoint returns information about the browser instance making the request. You can query this endpoint from within a script to resolve a browser's BrowserID.


						
var authdata = "?Token={token}&UserID={userid}";

var url = 'https://api.browserbucket.com/GetBrowserInfo/'+ authdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Release Browser

This API endpoint is used to release a browser ahead of the CloseAfter trigger, such as when a task takes less time than expected to complete.

<?php

print_r(sendRequest("GET", "ReleaseBrowser", "&BrowserID=cbb28f187319784cd6be2aa53b053155_5b47b5ad85249"));

function sendRequest($method_is, $urlvar1, $urlvar2)
{

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}

var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&BrowserID={browserID}";

var url = 'https://api.browserbucket.com/ReleaseBrowser/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Launch Tab

This API endpoint is used to open a new tab on a browser instance.

<?php

print_r(sendRequest("GET", "LaunchTab", "&BrowserID=cbb28f187319784cd6be2aa53b053155_5b47bed8c01c1"));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}

var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&BrowserID={BrowserID}";

var url = 'https://api.browserbucket.com/LaunchTab/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Get Tabs

This API endpoint returns a list of the open tabs on a browser instance.

<?php

print_r(sendRequest("GET", "GetTabs", "&BrowserID=cbb28f187319784cd6be2aa53b053155_5b47bed8c01c1"));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}
var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&BrowserID={BrowserID}";

var url = 'https://api.browserbucket.com/GetTabs/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Close Tab

This API endpoint is used to close a tab on a browser instance.

<?php

print_r(sendRequest("GET", "CloseTab", "&BrowserID=cbb28f187319784cd6be2aa53b053155_5b47bed8c01c1&TabID=40"));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}

var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&BrowserID={BrowserID}&TabID={TabID}";

var url = 'https://api.browserbucket.com/CloseTab/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Send JavaScript

This API endpoint is used to execute JavaScript code on a specific tab on a specific browser instance.

<?php

print_r(sendRequest("POST", "SendJavaScript", "&BrowserID=cbb28f187319784cd6be2aa53b053155_5b47bed8c01c1&TabID=38&Code=" . urlencode("window.location.href = 'http://www.bing.com';")));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&BrowserID={BrowserID}&TabID={TabID}";

var url = 'https://api.browserbucket.com/SendJavaScript/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('POST', url);
xmlhttp.setRequestHeader("Content-Type", "application/javascript ");
xmlhttp.send("console.log('code entered here');");

Attach JavaScript File

This API endpoint is used to attach a JavaScript file to a specufuc tab on a browser instance.

<?php

print_r(sendRequest("POST", "AttachJavaScriptFile", "&BrowserID=cbb28f187319784cd6be2aa53b053155_5b47c28ebca13&TabID=42&URL_Type=remote&URL_Data=" . urlencode("http://www.browserbucket.com/remote.php") . "&Persists=false"));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}


var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&BrowserID={BrowserID}&TabID={TabID}&Persists={0or1}&Script_URL={scripturl}";

var url = 'https://api.browserbucket.com/AttachJavaScriptFile/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Upload File

This API endpoint is used to populate a file input on a specific tab on a browser instance. The File_URL is the remote location of the file (i.e. https://i.imgur.com/9AdeIm1.jpg). File_Name is the desired local name of the file (i.e. cute_cat_pick.jpg). Selector is the CSS selector of the fileinput element you wish to associate the file (i.e. .fileinput1).

<?php

print_r(sendRequest("GET", "UploadFile", "&BrowserID=cbb28f187319784cd6be2aa53b053155_5b496e0cbc4ec&TabID=78&File_Name=whatever.jpg&Selector=" . urlencode("#fileToUpload") . "&File_URL=" . urlencode("https://i.redd.it/ximscyycrs911.jpg")));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}


var authdata = "?Token={Token}&UserID={UserID}";
var ajaxdata = authdata + "&BrowserID={BrowserID}&TabID={TabID}&File_Name={FileName}&Selector=" + encodeURIComponent("{Selector}") + "&File_URL=" + encodeURIComponent("{FileURL}");

var url = 'https://api.browserbucket.com/UploadFile/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Get File Transfer Status

If you're loading a remote script, be sure to set the Access-Control-Allow-Origin header to *. This is required

<?php

print_r(sendRequest("GET", "GetFileTransferStatus", "&TransferID={TransferID}"));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}


var authdata = "?Token={Token}&UserID={UserID}";
var ajaxdata = authdata + "&TransferID={TransferID}";

var url = 'https://api.browserbucket.com/GetFileTransferStatus/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();

Take Screenshot

This API endpoint is used to take a screenshot of a tab on a browser instance.

<?php

print_r(sendRequest("GET", "TakeScreenshot", "&BrowserID=cbb28f187319784cd6be2aa53b053155_5b47c28ebca13&TabID=42"));


function sendRequest($method_is, $urlvar1, $urlvar2)
{
	
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.browserbucket.com/" . $urlvar1 . "/?Token=go7Y5ynGOtCgOkmeBZnxg04ShjMHLLW1&UserID=cbb28f187319784cd6be2aa53b053155" . $urlvar2,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => $method_is,
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl); 
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  print "Curl Error.";
  exit;
} else {
  return json_decode($response, true);
}

}

var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&BrowserID={BrowserID}&TabID={TabID}";

var url = 'https://api.browserbucket.com/TakeScreenshot/'+ ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.send();