Created
November 28, 2016 10:56
-
-
Save ytakky2014/d2220aa767391f0955771f908b260952 to your computer and use it in GitHub Desktop.
Use Docomo Image API Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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