concordia-server/cat/tm_info.php_pattern

26 lines
635 B
Plaintext
Raw Normal View History

2017-03-13 11:42:44 +01:00
<?php
$url = 'http://@concordia_host@:@concordia_port@';
$request = array("operation" => "getTmsInfo");
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => json_encode($request),
),
);
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$data = json_decode($response);
foreach ($data->tms as $tm) {
echo $tm->id."\t".$tm->name." (".$tm->sourceLanguageCode."-> ".$tm->targetLanguageCode.")\n";
}
?>