PHP code example of huasx / ai-face

1. Go to this page and download the library: Download huasx/ai-face library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

huasx / ai-face example snippets


//get token
$ret = $obj->init(
    [
        'client_id'     => 'Your Client Id',
        'client_secret' => 'Your Client Secret',
    ]
)->getToken();
var_dump($ret->getBody());



//seach
$search = [
    'image'         => 'https://ai.bdstatic.com/file/52BC00FFD4754A6298D977EDAD033DA0',
    'image_type'    => 'URL',
    'group_id_list' => 'group1',
];

$obj = new \AIFace\Baidu\Face();

$ret = $obj->init([
    'token' => $token,
])->search($search);

var_dump($ret->getBody());