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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Thanks for the script . was really helpful for the hackathon