florianv/snoop

Find informations about an email address owner

v1.0.0 2014-06-13 23:47 UTC

This package is auto-updated.

Last update: 2024-11-05 00:37:16 UTC


README

⚠️ This tool is currently broken as Rapportive recently changed their API so the trick is not available anymore.

Snoop finds informations about an email address owner such as its name, social profiles, images and jobs.

Installation

Add this line to your composer.json file:

{
    "require": {
        "florianv/snoop": "~1.0"
    }
}

Currently Guzzle 3 and 4 are supported HTTP clients, so you will need to require one of them:

  • "guzzle/guzzle": "~3.0"
  • "guzzlehttp/guzzle": "~4.0"

Usage

You can find a simple example using it here

First, you need to create an adapter:

// 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());

Then you can create a Snoop instance and use it:

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

// Find the person with email 'john@doe.com'
$person = $snoop->find('john@doe.com');

$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
}

By default, two requests will be issued: one to get a token and the other to get the informations, but you can send them separately:

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

// Find the informations using the token
$person = $snoop->find('hello@world.com', $token);

Exception handling

InvalidTokenException

The InvalidTokenException is thrown when the token is missing or invalid.

try {
    $snoop->find('hello@world.com');
} catch (Snoop\Exception\InvalidTokenException $e) {
    // You might fetch a new token and retry
}

PersonNotFoundException

The PersonNotFoundException is thrown when there is no data associated with the email.

try {
    $snoop->find('hello@world.com');
} catch (Snoop\Exception\PersonNotFoundException $e) {
    // This person was not found
}

Notes

  • The API limit is around 50 requests with the same IP every hour
  • It uses a non-documented feature of the Rapportive API explained here
  • There are other implementations using it Python, Ruby

License

MIT