PHP code example of heise / shariff
1. Go to this page and download the library: Download heise/shariff 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/ */
heise / shariff example snippets
use Heise\Shariff\LaminasCache;
/**
* Sample configuration
*
* @var array
*/
private static $configuration = [
'cacheClass' => 'Heise\\Shariff\\LaminasCache',
'cache' => [
'ttl' => 60,
'cacheDir' => '/tmp/shariff/cache',
'adapter' => 'Filesystem',
'adapterOptions' => [
// ...
]
],
'client' => [
'timeout' => 4.2,
'headers' => [
'User-Agent' => 'shariff/1.0',
]
// ... (see "Client options")
],
'domains' => [
'www.heise.de',
'www.ct.de'
],
'services' => [
'Facebook',
'Reddit',
'StumbleUpon',
'Pinterest',
'Xing',
'Buffer',
'Vk'
],
'Facebook' => [
'app_id' => '1234567890',
'secret' => 'terces'
]
];
use Heise\Shariff\Backend;
$options = [
"domains" => ["www.heise.de", "www.ct.de"],
"cache" => ["ttl" => 1],
"services" => ["Facebook", "Reddit", "StumbleUpon", "Pinterest", "Buffer", "Vk"]
];
$shariff = new Backend($options);
$counts = $shariff->get("https://www.heise.de/");
echo $counts["facebook"];