Installing An Email API

With the Email YoYo API for email verification, there is little installation needed. No software to download or install on your computer. The API is a cloud based Sofware as a Service (SaaS) that runs from our servers and connects to your website or application with a string.

Examples code for installing on your website or application are listed here.

PHP

<?php

    // URL which should be requested

    $url = 'http://api.emailyoyo.com/api/a/v1';

    $apikey = 'YOUR API KEY';  // API Key

    $email  = 'Email Address to Test';  // Email to test

    // jSON String for request

    $url .= "?email=$email&key=$apikey";

    // Initializing curl

    $ch = curl_init( $url );

    if($ch == false) {

        die ("Curl failed!");

    } else {

        // Configuring curl options

        $options = array(

            CURLOPT_RETURNTRANSFER => true,            

            CURLOPT_HTTPHEADER => array('Content-type: application/json')

        );

        // Setting curl options

        curl_setopt_array( $ch, $options );

        // Getting results

        $result =  curl_exec($ch); // Getting jSON result string

        // display JSON data

        echo "$result";                        

    }     

?>

C#

#region Usings

using System;
using System.IO;
using System.Net;

#endregion

    /// <summary>
    /// The program.
    /// </summary>
    internal class Program
    {
        #region Constants

        /// <summary>
        /// The api url.
        /// </summary>
        private const string ApiUrl = @"http://api.emailyoyo.com/api/a/v1";

        /// <summary>
        ///     0 = ApiUrl
        ///     1 = Email address to query
        ///     2 = API Key
        /// </summary>
        private const string QueryFormatString = @"{0}?email={1}&key={2}";

        /// <summary>
        /// The your api key.
        /// </summary>
        /// <remarks>
        /// /*ENTER YOUR API KEY HERE*/
        /// </remarks>
        private const string YourAPIKey = @"<!-- ENTER A VALID KEY HERE-->";

        #endregion

        #region Methods

        /// <summary>
        /// The main program entry point.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        private static void Main(string[] args)
        {
            Console.WriteLine("Input email address to verify");

            var readLine = Console.ReadLine();

            Console.WriteLine(string.Empty);

            var requestUrl = string.Format(QueryFormatString, ApiUrl, readLine, YourAPIKey);

            var myRequest = (HttpWebRequest)WebRequest.Create(requestUrl);

            WebResponse webResponse = null;

            try
            {
                webResponse = myRequest.GetResponse();

                using (var reader = new StreamReader(webResponse.GetResponseStream()))
                {
                    var jsonString = reader.ReadToEnd();

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Result:");
                    Console.WriteLine(jsonString);
                    Console.ResetColor();
                    Console.WriteLine("Press <Enter> to continue..");
                    Console.ReadLine();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("An error occured:");
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Exception reported: {0}", exception.Message);
                Console.ResetColor();
                Console.WriteLine("Press <Enter> to continue..");
                Console.ReadLine();
            }
            finally
            {
                if (webResponse != null)
                {
                    webResponse.Dispose();
                }
            }
        }

        #endregion
    }

More examples can be provided by request using server examples of PHP, C#, VB.NET, Java, Python, and PERL. Client side examples include jQuery ACL, jQuery license key, AngularJS, and cURL.

Go back to the main email validation API guide.