import okhttp3.*;
import java.io.IOException;
public class Sample {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("img", "/9j")
.addFormDataPart("key", "M***********g")
.addFormDataPart("secret", "3***********6")
.addFormDataPart("typeId", "3100")
.addFormDataPart("format", "json")
.addFormDataPart("distortionCorrect", "1")
.addFormDataPart("autoRotation", "0")
.addFormDataPart("removeWaterMark", "0")
.addFormDataPart("imageEnhance", "0")
.addFormDataPart("removeHandwriting", "0")
.addFormDataPart("removeFinger", "0")
.build();
Request request = new Request.Builder()
.url("https://netocr.com/api/pic_process_base64")
.post(body)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
import requests
url = "https://netocr.com/api/pic_process_base64"
payload = {
"img": "/9j",
"key": "M***********g",
"secret": "3***********6",
"typeId": "3100",
"format": "json",
"distortionCorrect": "1",
"autoRotation": "0",
"removeWaterMark": "0",
"imageEnhance": "0",
"removeHandwriting": "0",
"removeFinger": "0"
}
response = requests.post(url, data=payload)
print(response.text)
var form = new FormData();
form.append("img", "/9j");
form.append("key", "M***********g");
form.append("secret", "3***********6");
form.append("typeId", "3100");
form.append("format", "json");
form.append("distortionCorrect", "1");
form.append("autoRotation", "0");
form.append("removeWaterMark", "0");
form.append("imageEnhance", "0");
form.append("removeHandwriting", "0");
form.append("removeFinger", "0");
fetch("https://netocr.com/api/pic_process_base64", {
method: "POST",
body: form
}).then(function(response) {
return response.json();
}).then(function(data) {
console.log(data);
});
<?php
$curl = curl_init('https://netocr.com/api/pic_process_base64');
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [
'img' => '/9j',
'key' => 'M***********g',
'secret' => '3***********6',
'typeId' => '3100',
'format' => 'json',
'distortionCorrect' => '1',
'autoRotation' => '0',
'removeWaterMark' => '0',
'imageEnhance' => '0',
'removeHandwriting' => '0',
'removeFinger' => '0'
]
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
using var client = new HttpClient();
using var content = new MultipartFormDataContent
{
{ new StringContent("/9j"), "img" },
{ new StringContent("M***********g"), "key" },
{ new StringContent("3***********6"), "secret" },
{ new StringContent("3100"), "typeId" },
{ new StringContent("json"), "format" },
{ new StringContent("1"), "distortionCorrect" },
{ new StringContent("0"), "autoRotation" },
{ new StringContent("0"), "removeWaterMark" },
{ new StringContent("0"), "imageEnhance" },
{ new StringContent("0"), "removeHandwriting" },
{ new StringContent("0"), "removeFinger" }
};
var response = await client.PostAsync("https://netocr.com/api/pic_process_base64", content);
Console.WriteLine(await response.Content.ReadAsStringAsync());
#include <cpprest/http_client.h>
#include <iostream>
int main() {
web::http::client::http_client client(U("https://netocr.com"));
web::http::multipart_content content;
content.add(web::http::name(U("img")), web::http::value(U("/9j")));
content.add(web::http::name(U("key")), web::http::value(U("M***********g")));
content.add(web::http::name(U("secret")), web::http::value(U("3***********6")));
content.add(web::http::name(U("typeId")), web::http::value(U("3100")));
content.add(web::http::name(U("format")), web::http::value(U("json")));
content.add(web::http::name(U("distortionCorrect")), web::http::value(U("1")));
content.add(web::http::name(U("autoRotation")), web::http::value(U("0")));
content.add(web::http::name(U("removeWaterMark")), web::http::value(U("0")));
content.add(web::http::name(U("imageEnhance")), web::http::value(U("0")));
content.add(web::http::name(U("removeHandwriting")), web::http::value(U("0")));
content.add(web::http::name(U("removeFinger")), web::http::value(U("0")));
auto response = client.request(web::http::methods::POST, U("/api/pic_process_base64"), content).get();
std::wcout << response.extract_string().get() << std::endl;
}
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
)
func main() {
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
fields := map[string]string{
"img": "/9j", "key": "M***********g", "secret": "3***********6",
"typeId": "3100", "format": "json", "distortionCorrect": "1",
"autoRotation": "0", "removeWaterMark": "0", "imageEnhance": "0",
"removeHandwriting": "0", "removeFinger": "0",
}
for key, value := range fields {
_ = writer.WriteField(key, value)
}
_ = writer.Close()
request, _ := http.NewRequest(http.MethodPost, "https://netocr.com/api/pic_process_base64", body)
request.Header.Set("Content-Type", writer.FormDataContentType())
response, _ := http.DefaultClient.Do(request)
defer response.Body.Close()
data, _ := io.ReadAll(response.Body)
fmt.Println(string(data))
}
const form = new FormData();
form.append("img", "/9j");
form.append("key", "M***********g");
form.append("secret", "3***********6");
form.append("typeId", "3100");
form.append("format", "json");
form.append("distortionCorrect", "1");
form.append("autoRotation", "0");
form.append("removeWaterMark", "0");
form.append("imageEnhance", "0");
form.append("removeHandwriting", "0");
form.append("removeFinger", "0");
const response = await fetch("https://netocr.com/api/pic_process_base64", {
method: "POST",
body: form
});
console.log(await response.text());
import Alamofire
AF.upload(multipartFormData: { form in
form.append(Data("/9j".utf8), withName: "img")
form.append(Data("M***********g".utf8), withName: "key")
form.append(Data("3***********6".utf8), withName: "secret")
form.append(Data("3100".utf8), withName: "typeId")
form.append(Data("json".utf8), withName: "format")
form.append(Data("1".utf8), withName: "distortionCorrect")
form.append(Data("0".utf8), withName: "autoRotation")
form.append(Data("0".utf8), withName: "removeWaterMark")
form.append(Data("0".utf8), withName: "imageEnhance")
form.append(Data("0".utf8), withName: "removeHandwriting")
form.append(Data("0".utf8), withName: "removeFinger")
}, to: "https://netocr.com/api/pic_process_base64").responseString { response in
print(response.value ?? "")
}
import okhttp3.*;
import java.io.IOException;
public class AndroidSample {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("img", "/9j")
.addFormDataPart("key", "M***********g")
.addFormDataPart("secret", "3***********6")
.addFormDataPart("typeId", "3100")
.addFormDataPart("format", "json")
.addFormDataPart("distortionCorrect", "1")
.addFormDataPart("autoRotation", "0")
.addFormDataPart("removeWaterMark", "0")
.addFormDataPart("imageEnhance", "0")
.addFormDataPart("removeHandwriting", "0")
.addFormDataPart("removeFinger", "0")
.build();
Request request = new Request.Builder()
.url("https://netocr.com/api/pic_process_base64")
.post(body)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}