Scrapes search results from Bing Image and Web Search.
Add this package to your composer.json
file with the following command
# Install Composer
curl -sS https://getcomposer.org/installer | php
# Add BingScraper as a dependency
php composer.phar require mojopollo/bing-scraper
Next, require Composer's autoloader in your application to automatically load the BingScraper class into your project:
// Load the composer autoloader
require 'vendor/autoload.php';
// Alias the scraper classes
use Mojopollo\BingScraper\Image as BingImageScraper;
use Mojopollo\BingScraper\Web as BingWebScraper;
composer require mojopollo/bing-scraper
Next, add the following laravel 5 service provider by modifying your app/Providers/AppServiceProvider.php
as so:
public function register()
{
$this->app->register('Mojopollo\BingScraper\ImageServiceProvider');
}
In progress
// Load the composer autoloader
require 'vendor/autoload.php';
// Alias the scraper image class
use Mojopollo\BingScraper\Image as BingImageScraper;
// Instantiate image scraper class
$bingImageScraper = new BingImageScraper;
// Set options and scrape
// see "options" section in this readme for all available options
$bingImageScraper
->query('sloth smiling')
->safe('strict')
->type('photograph')
->scrape();
// This is what you get back
// [
// 'meta' => [
// 'status' => 200,
// 'error' => null,
// 'count' => 20
// ],
// 'results' => [
// [
// 'url' => 'http://example.com/my-sloths',
// 'image' => 'http://example.com/my-sloths/images/sloth-smiling.jpg',
// 'width' => '1900',
// 'height' => '600',
// 'format' => 'jpeg',
// 'meta' => [
// 'ns' => 'images',
// 'k' => '3599',
// 'mid' => 'FXDP1BZ7EHN12BL7O2QVTZOXO0UYTGSRDHKF1COX',
// 'cid' => 'zAN2dtE2',
// 'md5' => '49f68a5c8493ec2c0bf489821c21fc3b',
// 'tid' => 'OIP.O6qE4AQEPKPewVVT746gVXk6dqMNIsQEybC',
// 'docid' => '329832932856960383',
// 'tft' => '45',
// 'mw' => '634',
// 'mh' => '1024',
// 'thH' => '300',
// 'thW' => '18'"
// ]
// ],
// ...
// ]
// ]