Face++ 人脸搜索的API调用(PHP)

我注册了一个face++账号,成功调用了人脸对比的API,但是在进行人脸搜索(Face++ Search)
的时候,绊住了。如下是官方给的API文档,但是这个是针对人脸识别的,请问如何
将这段代码改成人脸搜索的PHP文档?

<?php
    $image="/tmp/1.jpg";                //图片地址
    $fp = fopen($image, 'rb');
    $content = fread($fp, filesize($image)); //二进制数据
    $curl = curl_init();   
    curl_setopt_array($curl, array(
       CURLOPT_URL => "https://api-cn.faceplusplus.com/facepp/v3/detect",     //输入URL
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_ENCODING => "",
       CURLOPT_MAXREDIRS => 10,
       CURLOPT_TIMEOUT => 30,
       CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
       CURLOPT_CUSTOMREQUEST => "POST",
       CURLOPT_POSTFIELDS => array('image_file";filename="image'=>"$content", 'api_key'=>"******",'api_secret'=>"******",'return_landmark'=>"1",'return_attributes'=>"gender,age,smiling,headpose,facequality,blur,eyestatus,emotion,ethnicity,beauty,mouthstatus,eyegaze,skinstatus"),   //输入api_key和api_secret
       CURLOPT_HTTPHEADER => array("cache-control: no-cache",),
       ));   
    $response = curl_exec($curl);
    $err = curl_error($curl);   
    curl_close($curl);   
    if ($err) {
        echo "cURL Error #:" . $err;
    } else {
        echo $response;
    }
?> 
查看全部
qq_41809947
山林小树
2019/04/09 15:06
  • php
  • 点赞
  • 收藏
  • 回答
    私信

0个回复