In order to access VROfficePlace Image Api, please create your account at https://www.vrofficeplace.com/admin/register.php and download API document. You may also find a code samples bellow.
ImageRecognitionAPI
API EndPoint: https://www.vrofficeplace.com/admin/api/faceapi.php
Perl Example:
use strict;
use warnings;
use MIME::Base64;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;
my $username = 'YourUsername';
my $password = 'YourPassword';
open (my $image1, 'image1.jpg') or die "$!";
binmode $image1;
my $raw_string1 = do{ local $/ = undef; <$image1>; };
my $encoded1 = encode_base64( $raw_string1 );
open (my $image2, 'image2.jpg') or die "$!";
binmode $image2;
my $raw_string2 = do{ local $/ = undef; <$image2>; };
my $encoded2 = encode_base64( $raw_string2 );
my $ua = LWP::UserAgent->new;
my $req = POST 'https://vrofficeplace.com/admin/api/faceapi.php',
[ username => $username, password => $password, image1 => $encoded1, image2 => $encoded2 ];
print $ua->request($req)->as_string;
Python Example:
#!/usr/bin/python
import base64
from io import BytesIO
import requests
username = "My Verofficeplace Username"
password = "My Verofficeplace Password"
with open("image1.jpg", "rb") as image_file1:
data1 = base64.b64encode(image_file1.read())
with open("image2.jpg", "rb") as image_file2:
data2 = base64.b64encode(image_file2.read())
#print data1
url = 'https://www.vrofficeplace.com/admin/api/faceapi.php'
payload = {'username': username, 'password': password, 'image1': data1, 'image2': data2}
r = requests.post(url, data=payload)
# Response, status etc
print(r.text)
print(r.status_code)
PHP Example:
$apiusername = 'Your VROffice Username';
$apipassword = 'Your VROffice Passsword';
$im1 = file_get_contents('image1.jpg');
$imdata1 = base64_encode($im1);
$im2 = file_get_contents('image2.jpg');
$imdata2 = base64_encode($im2);
$url = 'https://www.vrofficeplace.com/admin/api/faceapi.php';
//The data you want to send via POST
$fields = [
'username' => $apiusername,
'password' => $apipassword,
'image1' => $imdata1,
'image2' => $imdata2
];
$fields_string = http_build_query($fields);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
echo $result;