网站地址: https://console.faceplusplus.com.cn/documents/5671791
主要有
1 人脸识别技术
2 人体识别技术
3 证件识别技术
4 图像识别技术
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'=>"******"), //输入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;
}
?>
注明:以上地址必须为HTTPS 此处涉及到打开ssl协议
本人只加了
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
使他不验证证书;
放回数据:
{"image_id": "DTC9neX54HYcdrzXecFlJA==", "request_id": "1503986138,4d662641-01fa-437b-8f89-bc207061a023", "time_used": 769, "faces": [{"face_rectangle": {"width": 649, "top": 1262, "left": 321, "height": 649}, "face_token": "34a881f541b135d1a9d1cd2ff834a7fa"}]}
以上为成功,当然可以带上参数,原文档地址
https://console.faceplusplus.com.cn/documents/4888373
转载于:https://www.cnblogs.com/wustart/p/7447987.html