PHP code example of florianv / snoop

1. Go to this page and download the library: Download florianv/snoop 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/ */

    

florianv / snoop example snippets


// If you use Guzzle 3
$adapter = new \Snoop\Adapter\Guzzle3Adapter(new \Guzzle\Http\Client());

// If you use Guzzle 4
$adapter = new \Snoop\Adapter\Guzzle4Adapter(new \GuzzleHttp\Client());

// Create a Snoop instance
$snoop = new \Snoop\Snoop($adapter);

// Find the person with email '[email protected]'
$person = $snoop->find('[email protected]');

$person->getFirstName(); // John
$person->getLastName(); // Doe
$person->getLocation(); // San Francisco Bay Area
$person->getHeadline(); // Developer at Google

foreach ($person->getImages() as $url) {}

foreach ($person->getJobs() as $job) {
    $job->getTitle(); // Developer
    $job->getCompanyName(); // Google
}

foreach ($person->getProfiles() as $profile) {
    $profile->getSiteName(); // Twitter
    $profile->getUsername(); // johndoe
}

// Fetch a token, maybe store it somewhere
$token = $snoop->fetchToken();

// Find the informations using the token
$person = $snoop->find('[email protected]', $token);

try {
    $snoop->find('[email protected]');
} catch (Snoop\Exception\InvalidTokenException $e) {
    // You might fetch a new token and retry
}

try {
    $snoop->find('[email protected]');
} catch (Snoop\Exception\PersonNotFoundException $e) {
    // This person was not found
}