Email Verification API

HTTP | C | cURL | C# | GO | JAVA | JavaScript | NodeJS | Objective-C

OCaml | PHP | Python | Ruby | Shell | Swift

Alternatively, you can find the sample code on our GitHub Account.

.

HTTP

POST /email_verification/ HTTP/1.1
Host: api.evasrv.com
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=

↑ Top

C

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.evasrv.com/email_verification/");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "cache-control: no-cache");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=");

CURLcode ret = curl_easy_perform(hnd);

↑ Top

cURL

curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'email=test@domain.com&user_API_token=YOUR-EV-API-TOKEN&=' "https://api.evasrv.com/email_verification/"

↑ Top

C#

var client = new RestClient("https://api.evasrv.com/email_verification/");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("cache-control", "no-cache");
request.AddParameter("application/x-www-form-urlencoded", "email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

↑ Top

GO

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.evasrv.com/email_verification/"

  payload := strings.NewReader("email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("cache-control", "no-cache")
  req.Header.Add("content-type", "application/x-www-form-urlencoded")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

↑ Top

JAVA: OK HTTP

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.evasrv.com/email_verification/"

  payload := strings.NewReader("email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("cache-control", "no-cache")
  req.Header.Add("content-type", "application/x-www-form-urlencoded")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

 JAVA: UniRest

HttpResponse<String> response = Unirest.post("https://api.evasrv.com/email_verification/")
  .header("cache-control", "no-cache")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=")
  .asString();

↑ Top

JavaScript: JQuery AJAX

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.evasrv.com/email_verification/",
  "method": "POST",
  "headers": {
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded"
  },
  "data": {
    "email": "test@domain.com",
    "user_API_token": "YOUR-EV-API-TOKEN",
    "": ""
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

↑ Top

 JavaScript: XHR

var data = "email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.evasrv.com/email_verification/");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

xhr.send(data);

↑ Top

NodeJS: Native

var qs = require("querystring");
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "api.evasrv.com",
  "port": null,
  "path": "/email_verification/",
  "headers": {
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(qs.stringify({ email: 'test@domain.com',
  user_API_token: 'YOUR-EV-API-TOKEN',
  '': '' }));
req.end();

↑ Top

 NodeJS: Request

var request = require("request");

var options = { method: 'POST',
  url: 'https://api.evasrv.com/email_verification/',
  headers: 
   { 'content-type': 'application/x-www-form-urlencoded',
     'cache-control': 'no-cache' },
  form: 
   { email: 'test@domain.com',
     user_API_token: 'YOUR-EV-API-TOKEN',
     '': '' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

↑ Top

 NodeJS: UniRest

var unirest = require("unirest");

var req = unirest("POST", "https://api.evasrv.com/email_verification/");

req.headers({
  "content-type": "application/x-www-form-urlencoded",
  "cache-control": "no-cache"
});

req.form({
  "email": "test@domain.com",
  "user_API_token": "YOUR-EV-API-TOKEN",
  "": ""
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});

↑ Top

Objective-C: NSURL

#import <Foundation/Foundation.h>

NSDictionary *headers = @{ @"cache-control": @"no-cache",
                           @"content-type": @"application/x-www-form-urlencoded" };

NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"email=test@domain.com" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&user_API_token=YOUR-EV-API-TOKEN" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&=" dataUsingEncoding:NSUTF8StringEncoding]];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.evasrv.com/email_verification/"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];

↑ Top

OCaml: CoHTTP

open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "https://api.evasrv.com/email_verification/" in
let headers = Header.init ()
  |> fun h -> Header.add h "cache-control" "no-cache"
  |> fun h -> Header.add h "content-type" "application/x-www-form-urlencoded"
in
let body = Cohttp_lwt_body.of_string "email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=" in

Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)

↑ Top

PHP: HTTP v1

<?php

$request = new HttpRequest();
$request->setUrl('https://api.evasrv.com/email_verification/');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'content-type' => 'application/x-www-form-urlencoded',
  'cache-control' => 'no-cache'
));

$request->setContentType('application/x-www-form-urlencoded');
$request->setPostFields(array(
  'email' => 'test@domain.com',
  'user_API_token' => 'YOUR-EV-API-TOKEN',
  '' => ''
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

 PHP: HTTP v2

<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append(new http\QueryString(array(
  'email' => 'test@domain.com',
  'user_API_token' => 'YOUR-EV-API-TOKEN',
  '' => ''
)));

$request->setRequestUrl('https://api.evasrv.com/email_verification/');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'content-type' => 'application/x-www-form-urlencoded',
  'cache-control' => 'no-cache'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

 PHP: CURL

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.evasrv.com/email_verification/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "content-type: application/x-www-form-urlencoded",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

↑ Top

Python: Python3

import http.client

conn = http.client.HTTPSConnection("api.evasrv.com")

payload = "email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&="

headers = {
    'cache-control': "no-cache",
    'content-type': "application/x-www-form-urlencoded"
    }

conn.request("POST", "/email_verification/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

 Python: Requests

import requests

url = "https://api.evasrv.com/email_verification/"

payload = "email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&="
headers = {
    'cache-control': "no-cache",
    'content-type': "application/x-www-form-urlencoded"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

↑ Top

Ruby

require 'uri'
require 'net/http'

url = URI("https://api.evasrv.com/email_verification/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["cache-control"] = 'no-cache'
request["content-type"] = 'application/x-www-form-urlencoded'
request.body = "email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&="

response = http.request(request)
puts response.read_body

↑ Top

Shell: Wget

wget --quiet \
  --method POST \
  --header 'cache-control: no-cache' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --body-data 'email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&=' \
  --output-document \
  - https://api.evasrv.com/email_verification/

 Shell: HTTPie

http --form POST https://api.evasrv.com/email_verification/ \
  cache-control:no-cache \
  content-type:application/x-www-form-urlencoded \
  email=test@domain.com \
  user_API_token=YOUR-EV-API-TOKEN \
  =''

 Shell: CURL

curl --request POST \
  --url https://api.evasrv.com/email_verification/ \
  --header 'cache-control: no-cache' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'email=test%40domain.com&user_API_token=YOUR-EV-API-TOKEN&='

↑ Top

Swift

import Foundation

let headers = [
  "cache-control": "no-cache",
  "content-type": "application/x-www-form-urlencoded"
]

var postData = NSMutableData(data: "email=test@domain.com".dataUsingEncoding(NSUTF8StringEncoding)!)
postData.appendData("&user_API_token=YOUR-EV-API-TOKEN".dataUsingEncoding(NSUTF8StringEncoding)!)
postData.appendData("&=".dataUsingEncoding(NSUTF8StringEncoding)!)

var request = NSMutableURLRequest(URL: NSURL(string: "https://api.evasrv.com/email_verification/")!,
                                        cachePolicy: .UseProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.HTTPMethod = "POST"
request.allHTTPHeaderFields = headers
request.HTTPBody = postData

let session = NSURLSession.sharedSession()
let dataTask = session.dataTaskWithRequest(request, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    println(error)
  } else {
    let httpResponse = response as? NSHTTPURLResponse
    println(httpResponse)
  }
})

dataTask.resume()

↑ Top

<< Back to Email Verification API for Developers