Face Verification

FREEMIUM
Verified
Door PresentID | Bijgewerkt 8 days ago | Visual Recognition
Populariteit

9.5 / 10

Latency

2,597ms

Serviceniveau

99%

Health Check

N/A

Terug naar alle discussies

i cant make binary foto in php

Rapid account: 190411100064
190411100064
3 years ago

`<form method=“post” enctype=“multipart/form-data”>
<input type=“file” name=“photo1” accept=“image/" capture>
<input type=“file” name=“photo2” accept="image/
” capture>
<input type=“submit” name=“submit” value=“Submit”>
</form>

$file2 = $_FILES[‘photo2’][‘tmp_name’];
$file1 = $_FILES[‘photo1’][‘tmp_name’];
data=[photo1=>@.data = [ 'photo1' => '@'.file1,
‘photo2’ => ‘@’.file2,];vardump(file2, ]; var_dump(data);

curl_setopt_array($curl, [
    CURLOPT_URL => "https://face-verification2.p.rapidapi.com/FaceVerification",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => $data,
    CURLOPT_HTTPHEADER => [
        "content-type: application/x-www-form-urlencoded",
        "x-rapidapi-host: face-verification2.p.rapidapi.com",
        "x-rapidapi-key: -"
    ],
]);`

someone can help me ?

Rapid account: 190411100064
190411100064 Commented 3 years ago

i always get this message
string(87) "{"hasError":true,"statusCode":400,"statusMessage":"There aren't any files in Request."}"

whether my data POSTFIELD is correct ?
<form action="test.php" encoding='multipart/form-data' method="post" enctype="multipart/form-data"> <input type="file" name="photo1" accept="image/*" capture> <input type="file" name="photo2" accept="image/*" capture> <input type="submit" name="submit" value="Submit"> </form>

$file1 = $_FILES['photo1']["tmp_name"];
$file2 = $_FILES['photo2']["tmp_name"];

$data = [
    'photo1'=> $file1,
    'photo2'=> $file2
];

curl_setopt_array($curl, [
CURLOPT_URL => “https://face-verification2.p.rapidapi.com/FaceVerification”,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => “”,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “POST”,
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => [
“content-type: multipart/form-data”,
“x-rapidapi-host: face-verification2.p.rapidapi.com”,
“x-rapidapi-key: -”
],
]);`

Rapid account: Present ID
PresentID Commented 3 years ago

change content-type in CURLOPT_HTTPHEADER:
"content-type: application/x-www-form-urlencoded", ----> "content-type: multipart/form-data".

Doe mee aan de discussie - voeg hieronder een opmerking toe

Log in / Schrij u in om nieuwe opmerkingen te plaatsen