<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $reviews = $api->get('/v4/rf/1/reviews', ['offset' => 0, 'limit' => 20, 'sort' => 'asc', 'directory' => '', 'stars' => '']); print_r($reviews);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $reports = $api->get('/v4/rf', ['client-id' => null]); print_r($reports);
/** * @param int $batchId * @return bool */ public function delete($batchId) { $results = $this->api->call('/v4/batch', array('batch-id' => $batchId), Api::HTTP_METHOD_DELETE); return $results['success']; }
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $success = $api->delete('/v4/rf/1'); print_r($success);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; use BrightLocal\Batches\V4 as BatchApi; $directories = array('google', 'citysearch', 'dexknows', 'kudzu', 'manta'); // setup API wrappers $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $batchApi = new BatchApi($api); // Step 1: Create a new batch $result = $batchApi->create(); if ($result['success']) { $batchId = $result['batch-id']; printf('Created batch ID %d%s', $batchId, PHP_EOL); // Step 2: Add directory jobs to batch foreach ($directories as $directory) { $result = $api->call('/v4/ld/fetch-profile-url', array('batch-id' => $batchId, 'local-directory' => $directory, 'business-names' => 'Eleven Madison Park', 'country' => 'USA', 'city' => 'New York', 'postcode' => '10010')); if ($result['success']) { printf('Added job with ID %d%s', $result['job-id'], PHP_EOL); } } // Step 3: Commit batch (to signal all jobs added, processing starts) $result = $batchApi->commit($batchId); if ($result['success']) { echo 'Committed batch successfully.' . PHP_EOL; } }
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $success = $api->post('/v4/rf/add', ['report-name' => 'Le Bernardin', 'client-id' => 0, 'business-name' => 'Le Bernardin', 'contact-telephone' => '+1 212-554-1515', 'address1' => '155 West 51st Street', 'address2' => '', 'city' => 'New York', 'postcode' => '10019', 'country' => 'USA', 'schedule' => 'M', 'run-on' => 1, 'receive-email-alerts' => 0, 'alert-email-addresses' => '["*****@*****.**","*****@*****.**","*****@*****.**"]', 'white-label-profile-id' => null, 'is-public' => 1, 'directories' => json_encode(['yellowbot' => ['url' => 'http://www.yellowbot.com/le-bernardin-new-york-ny.html', 'include' => 1], 'yellowpages' => ['url' => 'http://www.yellowpages.com/new-york-ny/mip/le-bernardin-9909153', 'include' => 1], 'yelp' => ['url' => 'http://www.yelp.com/biz/le-bernardin-new-york', 'include' => 1]])]); print_r($success);
/** * @param string $batchId * @return bool|mixed */ public function get_results($batchId) { return $this->api->call('/v1/get-batch-results', array('batch-id' => $batchId)); }
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $reports = $api->get('/v4/rf/search', ['q' => 'Le Bernardin']); print_r($reports);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; use BrightLocal\Batches\V4 as BatchApi; $profileUrls = array('https://plus.google.com/114222978585544488148/about?hl=en', 'https://plus.google.com/117313296997732479889/about?hl=en', 'https://plus.google.com/111550668382222753542/about?hl=en'); // setup API wrappers $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $batchApi = new BatchApi($api); // Step 1: Create a new batch $batchId = $batchApi->create(); if ($batchId) { printf('Created batch ID %d%s', $batchId, PHP_EOL); // Step 2: Add review lookup jobs to batch foreach ($profileUrls as $profileUrl) { $result = $api->call('/v4/ld/fetch-reviews', array('batch-id' => $batchId, 'profile-url' => $profileUrl, 'country' => 'USA')); if ($result['success']) { printf('Added job with ID %d%s', $result['job-id'], PHP_EOL); } } // Step 3: Commit batch (to signal all jobs added, processing starts) if ($batchApi->commit($batchId)) { echo 'Committed batch successfully.' . PHP_EOL; } }
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $counts = $api->get('/v4/rf/1/stars/count'); print_r($counts);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $counts = $api->get('/v4/rf/1/reviews/count'); print_r($counts);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $growth = $api->get('/v4/rf/1/reviews/growth'); print_r($growth);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $directories = $api->get('/v4/rf/1/directories'); print_r($directories);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $report = $api->get('/v4/rf/1'); print_r($report);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $stats = $api->get('/v4/rf/1/directories/stats'); print_r($stats);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $success = $api->post('/v4/rf/add', ['report-name' => 'Le Bernardin', 'client-id' => 0, 'business-name' => 'Le Bernardin', 'contact-telephone' => '+1 212-554-1515', 'address1' => '155 West 51st Street', 'address2' => '', 'city' => 'New York', 'postcode' => '10019', 'country' => 'USA', 'schedule' => 'M', 'run-on' => 1, 'receive-email-alerts' => 0, 'alert-email-addresses' => '["*****@*****.**","*****@*****.**","*****@*****.**"]', 'white-label-profile-id' => null, 'is-public' => 1]); print_r($success);
<?php require '../Auth.php'; require '../../vendor/autoload.php'; use BrightLocal\Api; $api = new Api(API_KEY, API_SECRET, API_ENDPOINT); $success = $api->put('/v4/rf/1', ['report-name' => 'Le Bernardin', 'schedule' => 'W', 'run-on' => 3, 'directories' => json_encode(['yelp' => ['url' => 'http://www.yelp.com/biz/le-bernardin-new-york', 'include' => 1]])]); print_r($success);