Skip to content

Instantly share code, notes, and snippets.

@mikeknoop
Forked from bryanhelmig/examples.js
Created March 21, 2012 05:37
Show Gist options
  • Save mikeknoop/2144861 to your computer and use it in GitHub Desktop.
Save mikeknoop/2144861 to your computer and use it in GitHub Desktop.
EmailPie Samples
// An invalid domain.
// http://emailpie.com/v1/[email protected]
{
"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/[email protected]
{
"didyoumean": "[email protected]",
"errors": [],
"success": true
}
// Finally, a good email!
// http://emailpie.com/v1/[email protected]
{
"didyoumean": null,
"errors": [],
"success": true
}
$ch = curl_init();
$params['email'] = '[email protected]';
curl_setopt($ch, CURLOPT_URL, 'http://emailpie.com/v1/check');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('json' => json_encode($params)));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
import requests
import simplejson
params = {'email': '[email protected]'}
response = requests.get('http://emailpie.com/v1/check', params=params)
response = simplejson.loads(response.content)
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment