1. Go to this page and download the library: Download datasift/datasift-php 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/ */
datasift / datasift-php example snippets
// Load the library (If you're using this library standalone)
d.php';
// An object of this type will receive events
class EventHandler implements DataSift_IStreamConsumerEventHandler
{
public function onInteraction($consumer, $interaction, $hash)
{
echo $interaction['interaction']['content']."\n";
}
// Ignore the other events for the purposes of this example.
public function onConnect($consumer) { }
public function onDeleted($consumer, $interaction, $hash) { }
public function onStatus($consumer, $type, $info) { }
public function onWarning($consumer, $message) { }
public function onError($consumer, $message) { }
public function onDisconnect($consumer) { }
public function onStopped($consumer, $reason) { }
}
// Create the user
$user = new DataSift_User('your username', 'your api_key');
// Create a definition looking for the word "datasift"
$def = $user->createDefinition('interaction.content contains "datasift"');
// Get an HTTP stream consumer for that definition
$consumer = $def->getConsumer(DataSift_StreamConsumer::TYPE_HTTP, new EventHandler());
// Consume it - this will not return unless the stream gets disconnected
$consumer->consume();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.