How does PHP call the FACE++ API to implement url face comparison (code example)

不言
Release: 2023-04-03 22:46:01
Original
3642 people have browsed it

The content of this article is about how PHP calls the FACE API to implement url face comparison (code example). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

output code (out.php).

  

Face Compare System

URL1:

URL2:

Copy after login

php code

   
"https://api-cn.faceplusplus.com/facepp/v3/compare", //输入URL CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array('image_url1'=>$image1,'image_url2'=>$image2, 'api_key'=>"p-4a6YPMwxYTfzt9bvY8hw3CFF1f0rt4",'api_secret'=>"hpWzxBorFtEcSfjvs9jbywp5g4RX2ef8"), //输入api_key和api_secret CURLOPT_HTTPHEADER => array("cache-control: no-cache",), )); curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { $arr=json_decode($response,true); echo "人脸匹配度为"; echo $arr["confidence"],"%"; } ?>
Copy after login

After configuring the php environment, place these two files in the root directory. Runnable.

Running effect:
Input:
How does PHP call the FACE++ API to implement url face comparison (code example)

Output:
How does PHP call the FACE++ API to implement url face comparison (code example)

Related recommendations:

PHP uses the Face interface to develop the WeChat public platform face recognition system, face recognition system

Free face recognition api

The above is the detailed content of How does PHP call the FACE++ API to implement url face comparison (code example). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!