Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of classifying an image using Visual Recognition in PHP
<?php
$data = ;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_POST => true,
CURLOPT_URL => "https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classify?version=2015-12-02",
CURLOPT_USERPWD => "USERNAME:PASSWORD",
CURLOPT_POSTFIELDS => array("images_file" => "@/path/to/your/image.png"),
CURLOPT_RETURNTRANSFER => true
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
@200GAUTAM

This comment has been minimized.

Copy link

@200GAUTAM 200GAUTAM commented Sep 27, 2016

Thanks for the script . was really helpful for the hackathon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment