forked from UoEMainLibrary/ASRestAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestGetTermsFromAS.php
34 lines (30 loc) · 1.02 KB
/
testGetTermsFromAS.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* Created by JetBrains PhpStorm.
* User: cknowles
* Date: 08/01/2014
* Time: 14:22
* To change this template use File | Settings | File Templates.
*/
//$url = "http://localhost:8089/";
//$response = file_get_contents($url);
//echo $response;
//Example using CURL for Get
//next example will recieve all messages for specific conversation
//$service_url = 'http://example.com/api/conversations/[CONV_CODE]/messages&apikey=[API_KEY]';
$service_url = 'http://localhost:8089/terms?q=t';
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($curl);
if ($curl_response === false) {
$info = curl_getinfo($curl);
curl_close($curl);
die('error occurred during curl exec. Additional info: ' . var_export($info));
}
curl_close($curl);
$decoded = json_decode($curl_response);
if (isset($decoded->response->status) && $decoded->response->status == 'ERROR') {
die('error occurred: ' . $decoded->response->errormessage);
}
echo 'response ok!';
print_r($decoded);