PRODUCTDEMO

  • OCR Results
  • JSON Results

                

API Document

1. The image is a base64 stream
Interface address: https://flyocr.com/verapi/verFaceImage.do
Interface call method: post
Interface receiving parameter:
Serial number name type required Instructions
1 img1 String Yes Uploaded file (base64 stream of pictures)
Supported image formats: BMP/JPG/TIF/PNG/WSQ/JP2 / states JPC/J2K/TFF
The size is about 200KB
2 img2 String Yes Uploaded file (base64 stream of pictures)
Supported image formats: BMP/JPG/TIF/PNG/WSQ/JP2 / states JPC/J2K/TFF
The size is about 200KB
3 key String Yes User ocrKey
4 token String Yes Authorization token
5 timestamp String Yes Yes The number of seconds with timestamp January 1 1970 00:00:00 GMT until now
6 typeId Integer Yes Recognition type:21
2. Sample code
  • Java
  • Python
  • Javascript
  • PHP
  • C#
  • C++
  • GO
  • Node.js
  • IOS
  • Android

//dependency:okio-1.14.0,shiro-core-1.4.0,okhttp-3.11.0
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.apache.shiro.crypto.hash.Md5Hash;
import java.io.IOException;
import java.time.Instant;

public class Test {

    public static void main(String[] args) throws IOException {

        String key = "M***********g";
        String secret = "3***********6";

        long timestamp = Instant.now().toEpochMilli();
        String token = new Md5Hash(key + "+" + timestamp + "+" + secret).toString();

        RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
                .addFormDataPart("img1", "/9j")
                .addFormDataPart("img2", "/9j")
                .addFormDataPart("key", key)
                .addFormDataPart("token", token)
                .addFormDataPart("timestamp", String.valueOf(timestamp))
                .addFormDataPart("typeId", "21")
                .build();
        Request request = new Request.Builder()
                .url("https://flyocr.com/verapi/verFaceImage.do")
                .method("POST", body)
                .build();
        OkHttpClient client = new OkHttpClient();
        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}

import requests
import hashlib
import time

def generate_token(key, timestamp, secret):
    hash_string = f"{key}+{timestamp}+{secret}"
    return hashlib.md5(hash_string.encode()).hexdigest()

def make_request():
    key = "M***********g"
    secret = "3***********6"
    timestamp = int(time.time() * 1000)
    token = generate_token(key, timestamp, secret)

    files = {
        'key': (None, key),
        'typeId': (None, '21'),
        'timestamp': (None, str(timestamp)),
        'token': (None, token),
        'img1': (None, "/9j"),
        'img2': (None, "/9j")
    }

    response = requests.post('https://flyocr.com/verapi/verFaceImage.do', files=files)
    return response.text

if __name__ == '__main__':
    response_text = make_request()
    print(response_text)

const crypto = require('crypto');
const FormData = require('form-data');
const $ = require('jquery');

var key = "M***********g";
var secret = "3***********6";
var timestamp = Date.now();

var token = crypto.createHash('md5').update(key + "+" + timestamp + "+" + secret).digest('hex');

var form = new FormData();
form.append("key", key);
form.append("typeId", "21");
form.append("timestamp", String(timestamp));
form.append("token", token);
form.append("img1", "/9j");
form.append("img2", "/9j");

var settings = {
 "url": "https://flyocr.com/verapi/verFaceImage.do",
 "method": "POST",
 "timeout": 0,
 "processData": false,
 "mimeType": "multipart/form-data",
 "contentType": false,
 "data": form,
 "success": function(response) {
     console.log(response);
 },
 "error": function(xhr, status, error) {
     console.error(status, error);
 }
};

$.ajax(settings);

<?php
$key = "M***********g";
$secret = "3***********6";
$timestamp = time();
$token = md5($key . '+' . $timestamp . '+' . $secret);

$data = array(
    'key' => $key,
    'typeId' => '21',
    'timestamp' => $timestamp,
    'token' => $token,
    'img1' => '/9j',
    'img2' => '/9j'
);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://flyocr.com/verapi/verFaceImage.do",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => $data,
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
?>

using System;
using System.IO;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

public class Test
{
    public static async Task Main(string[] args)
    {
        string key = "M***********g";
        string secret = "3***********6";
        long timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();

        using (var md5 = MD5.Create())
        {
            string rawData = key + "+" + timestamp + "+" + secret;
            byte[] inputBytes = Encoding.UTF8.GetBytes(rawData);
            byte[] hashBytes = md5.ComputeHash(inputBytes);

            var sb = new StringBuilder();
            foreach (var t in hashBytes)
            {
                sb.Append(t.ToString("X2"));
            }
            string token = sb.ToString();

            using (var client = new HttpClient())
            {
                using (var content = new MultipartFormDataContent())
                {
                    content.Add(new StringContent(key), "key");
                    content.Add(new StringContent("21"), "typeId");
                    content.Add(new StringContent(timestamp.ToString()), "timestamp");
                    content.Add(new StringContent(token), "token");
                    content.Add(new StringContent("/91"), "img1");
                    content.Add(new StringContent("/91"), "img2");

                    string url = "https://flyocr.com/verapi/verFaceImage.do";
                    var response = await client.PostAsync(url, content);

                    string responseString = await response.Content.ReadAsStringAsync();
                    Console.WriteLine(responseString);
                }
            }
        }
    }
}

#include <iostream>
#include <sstream>
#include <string>
#include <curl/curl.h>
#include <openssl/md5.h>
#include <iomanip>
#include <chrono>

std::string getMd5Hash(const std::string& data) {
    unsigned char result[MD5_DIGEST_LENGTH];
    MD5(reinterpret_cast<const unsigned char*>(data.c_str()), data.size(), result);

    std::ostringstream sout;
    sout << std::hex << std::setfill('0');
    for (auto c : result) {
        sout << std::setw(2) << static_cast<int>(c);
    }

    return sout.str();
}

int main() {
    CURL* curl;
    CURLcode res;

    std::string key = "M***********g";
    std::string secret = "3***********6";
    auto timestamp = std::chrono::duration_cast<std::chrono::milliseconds>(
        std::chrono::system_clock::now().time_since_epoch()
    ).count();
    std::string token = getMd5Hash(key + "+" + std::to_string(timestamp) + "+" + secret);

    std::string data = "key=" + key + "&typeId=21×tamp=" +
                       std::to_string(timestamp) + "&token=" + token +
                       "&img1=/9j&img2=/9j";

    curl = curl_easy_init();
    if (curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "https://flyocr.com/verapi/verFaceImage.do");
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str());

        res = curl_easy_perform(curl);
        if (res != CURLE_OK) {
            std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << '\n';
        }

        curl_easy_cleanup(curl);
    }

    return 0;
}

package main

import (
    "bytes"
    "crypto/md5"
    "fmt"
    "io"
    "mime/multipart"
    "net/http"
    "time"
)

func main() {
    key := "M***********g"
    secret := "3***********6"
    timestamp := time.Now().UnixNano() / int64(time.Millisecond)
    tokenData := fmt.Sprintf("%s+%d+%s", key, timestamp, secret)

    h := md5.New()
    _, _ = io.WriteString(h, tokenData)
    token := fmt.Sprintf("%x", h.Sum(nil))

    body := &bytes.Buffer{}
    writer := multipart.NewWriter(body)

    _ = writer.WriteField("key", key)
    _ = writer.WriteField("typeId", "21")
    _ = writer.WriteField("timestamp", fmt.Sprintf("%d", timestamp))
    _ = writer.WriteField("token", token)
    _ = writer.WriteField("img1", "/9j")
    _ = writer.WriteField("img2", "/9j")

    writer.Close()

    req, err := http.NewRequest("POST", "https://flyocr.com/verapi/verFaceImage.do", body)
    if err != nil {
        fmt.Println("Error creating request:", err)
        return
    }
    req.Header.Set("Content-Type", writer.FormDataContentType())

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error sending request:", err)
        return
    }
    defer resp.Body.Close()

    respBody, err := io.ReadAll(resp.Body)
    if err != nil {
        fmt.Println("Error reading response:", err)
        return
    }

    fmt.Println("Response:", string(respBody))
}

const crypto = require('crypto');
const fetch = require('node-fetch');
const FormData = require('form-data');

const key = "M***********g";
const secret = "3***********6";

const timestamp = Date.now();
const token = crypto
  .createHash('md5')
  .update(`++`)
  .digest('hex');

const form = new FormData();
form.append('key', key);
form.append('typeId', '21');
form.append('timestamp', timestamp.toString());
form.append('token', token);
form.append('img1', '/9j');
form.append('img2', '/9j');

fetch('https://flyocr.com/verapi/verFaceImage.do', {
  method: 'POST',
  body: form
})
.then(response => response.text())
.then(console.log);

import Foundation
import Alamofire

func MD5(string: String) -> String {
    let length = Int(CC_MD5_DIGEST_LENGTH)
    let messageData = string.data(using:.utf8)!
    var digestData = Data(count: length)

    _ = digestData.withUnsafeMutableBytes { digestBytes -> UInt8 in
        messageData.withUnsafeBytes { messageBytes -> UInt8 in
            if let messageBytesBaseAddress = messageBytes.baseAddress,
                let digestBytesBlindMemory = digestBytes.bindMemory(to: UInt8.self).baseAddress {
                let messageLength = CC_LONG(messageData.count)
                CC_MD5(messageBytesBaseAddress, messageLength, digestBytesBlindMemory)
            }
            return 0
        }
    }
    return digestData.map { String(format: "%02hhx", $0) }.joined()
}

let key = "M***********g"
let secret = "3***********6"
let timestamp = "\(Int(Date().timeIntervalSince1970 * 1000))"
let token = MD5(string: "\(key)+\(timestamp)+\(secret)")

let parameters: [String: String] = [
    "key": key,
    "token": token,
    "timestamp": timestamp,
    "typeId": "21",
    "img1": "/9j",
    "img2": "/9j"
]

AF.upload(multipartFormData: { multipartFormData in
    for (key, value) in parameters {
        multipartFormData.append(value.data(using: .utf8)!, withName: key)
    }
}, to: "https://flyocr.com/verapi/verFaceImage.do")
.response { response in
    debugPrint(response)
}

import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.TimeUnit;

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class MyClass {

    public static void main(String[] args) {
        String key = "M***********g";
        String secret = "3***********6";

        long timestamp = System.currentTimeMillis();
        String tokenString = key + "+" + timestamp + "+" + secret;
        String token = md5(tokenString);

        RequestBody requestBody = new MultipartBody.Builder()
                .setType(MultipartBody.FORM)
                .addFormDataPart("key", key)
                .addFormDataPart("typeId", "21")
                .addFormDataPart("timestamp", Long.toString(timestamp))
                .addFormDataPart("token", token)
                .addFormDataPart("img1", "/91")
                .addFormDataPart("img2", "/91")
                .build();

        Request request = new Request.Builder()
                .url("https://flyocr.com/verapi/verFaceImage.do")
                .post(requestBody)
                .build();

        OkHttpClient client = new OkHttpClient.Builder()
                .connectTimeout(30, TimeUnit.SECONDS)
                .writeTimeout(30, TimeUnit.SECONDS)
                .readTimeout(30, TimeUnit.SECONDS)
                .build();

        try {
            Response response = client.newCall(request).execute();
            System.out.println(response.body().string());
            response.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String md5(String s) {
        try {
            MessageDigest digest = MessageDigest.getInstance("MD5");
            digest.update(s.getBytes());
            byte messageDigest[] = digest.digest();

            StringBuilder hexString = new StringBuilder();
            for (byte aMessageDigest : messageDigest) {
                String h = Integer.toHexString(0xFF & aMessageDigest);
                while (h.length() < 2)
                    h = "0" + h;
                hexString.append(h);
            }
            return hexString.toString();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return "";
    }
}
More API Introduction

PRODUCTFEATURES

APPLICATIONSCENARIOS

Facial Recognition with Identity Verification

Facial recognition technology addresses issues of impersonation and mismatched identity registration. Integrated with facial recognition API, facial information is compared with the portrait data on the document, ensuring alignment between the user and their provided documents during real-name authentication. 1:1 Face matching guarantees that uploaded information is genuine, valid, and consistent, enhancing overall security and reliability.

Facial Recognition with Remote Authentication

End users can utilize ID card recognition and facial recognition for automatic identity verification, applicable in e-commerce, O2O, and live broadcasting. OCR recognition API authenticates the identities of users including merchants, anchors, and others, effectively reducing input costs and controlling business risks.

Contact +86 173 1063 0901 Please leave your email

Intelligent Recognition

News|Blog

Stay in touch with FlyOCR

Please log in to experienceJump to login after 3 seconds

OK Cancel
Loading...
Operation verification
x

Fill in order with that colorThe same color verification code

Stay in touch with FlyOCR

Sign up to emails about FlyOCR news, product updates, and more.