Skip to content

Instantly share code, notes, and snippets.

@bryanhelmig
Created March 21, 2012 03:02
Show Gist options
  • Select an option

  • Save bryanhelmig/2143961 to your computer and use it in GitHub Desktop.

Select an option

Save bryanhelmig/2143961 to your computer and use it in GitHub Desktop.

Revisions

  1. bryanhelmig revised this gist Mar 21, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ruby.rb
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,12 @@
    require 'rubygems'
    require 'json'
    require 'net/http'
    require 'CGI'

    email = "email@totest.com"

    base_url = "http://emailpie.com/v1/check"
    url = "#{base_url}?email=#{URI.encode(email)}"
    url = "#{base_url}?email=#{CGI::escape(email)}"
    resp = Net::HTTP.get_response(URI.parse(url))
    result = JSON.parse(resp.body)

  2. bryanhelmig renamed this gist Mar 21, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. bryanhelmig renamed this gist Mar 21, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. bryanhelmig revised this gist Mar 21, 2012. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion php.php
    Original file line number Diff line number Diff line change
    @@ -1 +1,12 @@
    # todo
    $ch = curl_init();

    $email = "email@totest.com";
    $qs = "email=" . urlencode($email);
    $url = "http://emailpie.com/v1/check?" . $qs;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 0);

    $data = json_decode(curl_exec($ch));
    curl_close($ch);

    echo $data;
  5. bryanhelmig revised this gist Mar 21, 2012. 2 changed files with 14 additions and 2 deletions.
    3 changes: 2 additions & 1 deletion python.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,8 @@
    import requests
    import simplejson

    params = {'email': 'email@totest.com'}
    email = 'email@totest.com'
    params = {'email': email}
    response = requests.get('http://emailpie.com/v1/check', params=params)
    response = simplejson.loads(response.content)

    13 changes: 12 additions & 1 deletion ruby.rb
    Original file line number Diff line number Diff line change
    @@ -1 +1,12 @@
    # todo
    require 'rubygems'
    require 'json'
    require 'net/http'

    email = "email@totest.com"

    base_url = "http://emailpie.com/v1/check"
    url = "#{base_url}?email=#{URI.encode(email)}"
    resp = Net::HTTP.get_response(URI.parse(url))
    result = JSON.parse(resp.body)

    puts result
  6. bryanhelmig revised this gist Mar 21, 2012. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions examples.js
    Original file line number Diff line number Diff line change
    @@ -39,4 +39,14 @@
    "didyoumean": "tester@gmail.com",
    "errors": [],
    "success": true
    }


    // Finally, a good email!
    // http://emailpie.com/v1/check?email=tester@gmail.com

    {
    "didyoumean": null,
    "errors": [],
    "success": true
    }
  7. bryanhelmig revised this gist Mar 21, 2012. 1 changed file with 42 additions and 0 deletions.
    42 changes: 42 additions & 0 deletions examples.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    // An invalid domain.
    // http://emailpie.com/v1/check?email=notreal@example.com

    {
    "didyoumean": null,
    "errors": [
    {
    "message": "No MX records found for the domain.",
    "severity": 7
    }
    ],
    "success": false
    }


    // A poorly formatted email.
    // http://emailpie.com/v1/check?email=invalidemail

    {
    "didyoumean": null,
    "errors": [
    {
    "message": "Invalid email address.",
    "severity": 10
    },
    {
    "message": "No MX records found for the domain.",
    "severity": 7
    }
    ],
    "success": false
    }


    // A good, but possibly misspelled email.
    // http://emailpie.com/v1/check?email=tester@gnail.com

    {
    "didyoumean": "tester@gmail.com",
    "errors": [],
    "success": true
    }
  8. bryanhelmig created this gist Mar 21, 2012.
    1 change: 1 addition & 0 deletions php.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    # todo
    8 changes: 8 additions & 0 deletions python.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    import requests
    import simplejson

    params = {'email': 'email@totest.com'}
    response = requests.get('http://emailpie.com/v1/check', params=params)
    response = simplejson.loads(response.content)

    print(response)
    1 change: 1 addition & 0 deletions ruby.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    # todo