承接 florianv/snoop 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

florianv/snoop

Composer 安装命令:

composer require florianv/snoop

包简介

Find informations about an email address owner

README 文档

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

统计信息

  • 总下载量: 2.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 108
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 108
  • Watchers: 11
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-06-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固