PHP code example of skalmi / cakephp-diffbot-datasource

1. Go to this page and download the library: Download skalmi/cakephp-diffbot-datasource library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

skalmi / cakephp-diffbot-datasource example snippets


public $diffbot = array(
  'datasource' => 'DiffbotSource.Http/DiffbotSource',
  'host' => 'example.com',
  'port' => 'some port'
);
public $diffbotTest = array(
  'datasource' => 'DiffbotSource.Http/DiffbotSource',
  'host' => 'api.diffbot.com',
  'prefix' => '',
  'port' => 80,
  'timeout' => 5
);

public $useDbConfig = 'diffbot';
public $useTable = '<desired endpoint, for ex: "article">';

CakePlugin::load('HttpSource', array('bootstrap' => true, 'routes' => true));
CakePlugin::load('DiffbotSource', array('bootstrap' => false, 'routes' => false));

$this->Diffbot->setSource('article');
	$params = array(
		'conditions' => array(
			'query' => array(
				"term" => array("title" => "apple")
			)
		),
		'fields' => array('title', 'rank'),
		'order' => array('rank' => 'desc'),
		'offset' => 2
	);

$result = $this->Diffbot->find('first', $params);

:: database.php ::

:: Diffbot.php ::

:: bootstrap.php ::