Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use Docomo Image API Sample
<?php
$file = file_get_contents($image_path);
$ch = curl_init();
curl_setopt_array($ch,[
CURLOPT_URL => $api_url . '?APIKEY=' . $api_key,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [
'modelName' => 'food',
'image' => new CURLFile($image_path)
],
]);
$exec = curl_exec($ch);
$results = json_decode($exec);
$results = $results->candidates;
foreach ($results as $result) {
$tag = $result->tag;
$score = $result->score;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.