Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22d7930

Browse files
committed
Changed Image keywordexample url
1 parent 4e809bd commit 22d7930

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

example.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
$demo_text = 'Yesterday dumb Bob destroyed my fancy iPhone in beautiful Denver, Colorado. I guess I will have to head over to the Apple Store and buy a new one.';
2323
$demo_url = 'http://www.npr.org/2013/11/26/247336038/dont-stuff-the-turkey-and-other-tips-from-americas-test-kitchen';
2424
$demo_html = '<html><head><title>PHP Demo | AlchemyAPI</title></head><body><h1>Did you know that AlchemyAPI works on HTML?</h1><p>Well, you do now.</p></body></html>';
25-
$demo_image_url = 'http://media.npr.org/assets/img/2013/11/26/8069135368_e3e5e07a5f_o-3b8554ba72c125ca7d2e4b24dfd880b17fd405a1-s40.jpg';
2625

2726
echo PHP_EOL;
2827
echo PHP_EOL;
@@ -57,10 +56,10 @@
5756
echo PHP_EOL;
5857
echo PHP_EOL;
5958

60-
echo 'Processing Image URL: ', $demo_image_url, PHP_EOL;
59+
echo 'Processing Image URL: ', $demo_url, PHP_EOL;
6160
echo PHP_EOL;
6261

63-
$response = $alchemyapi->image_keywords('url', $demo_image_url, array('extractMode'=>'trust-metadata'));
62+
$response = $alchemyapi->image_keywords('url', $demo_url, array('extractMode'=>'trust-metadata'));
6463

6564
if ($response['status'] == 'OK') {
6665
echo '## Response Object ##', PHP_EOL;
@@ -69,7 +68,8 @@
6968
echo PHP_EOL;
7069
echo '## Image Keywords ##', PHP_EOL;
7170
foreach ($response['imageKeywords'] as $imageKeywords) {
72-
echo 'image keyword: ', $imageKeywords['text'], PHP_EOL;
71+
echo 'image keyword: ', $imageKeywords['text'], PHP_EOL;
72+
echo 'score: ', $imageKeywords['score'], PHP_EOL;
7373
echo PHP_EOL;
7474
}
7575
} else {

tests.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@
2323
$test_text = 'Bob broke my heart, and then made up this silly sentence to test the PHP SDK';
2424
$test_html = '<html><head><title>The best SDK Test | AlchemyAPI</title></head><body><h1>Hello World!</h1><p>My favorite language is PHP</p></body></html>';
2525
$test_url = 'http://www.nytimes.com/2013/07/13/us/politics/a-day-of-friction-notable-even-for-a-fractious-congress.html?_r=0';
26-
$test_image_url = 'http://media.npr.org/assets/img/2013/11/26/8069135368_e3e5e07a5f_o-3b8554ba72c125ca7d2e4b24dfd880b17fd405a1-s40.jpg';
2726

2827
//images
2928
echo 'Checking image keywords . . . ', PHP_EOL;
30-
$response = $alchemyapi->image_keywords('url', $test_image_url, null);
29+
$response = $alchemyapi->image_keywords('url', $test_url, null);
3130
assert($response['status'] == 'OK');
32-
$response = $alchemyapi->image_keywords('random', $test_image_url, null);
31+
$response = $alchemyapi->image_keywords('random', $test_url, null);
3332
assert($response['status'] == 'ERROR'); //invalid flavor
34-
echo 'Entity tests complete!', PHP_EOL, PHP_EOL;
33+
echo 'Image keyword tests complete!', PHP_EOL, PHP_EOL;
3534

3635
//Entities
3736
echo 'Checking entities . . . ', PHP_EOL;

0 commit comments

Comments
 (0)