php 소스
<?
// create a new instance of Services_JSON
require_once('JSON.php');
$json = new Services_JSON();
require_once('JSON.php');
$json = new Services_JSON();
// convert a complex value to JSON notation
$value = array(1, 2, 'foo');
$output = $json->encode($value);
echo $output."<br>";
$value = array(1, 2, 'foo');
$output = $json->encode($value);
echo $output."<br>";
// accept incoming POST data
$input = file_get_contents('http://192.168.0.10:8080/cgi-bin/filemanager/utilRequest.cgi?func=createdir&sid=xxxxxxxx&dest_folder=test&dest_path=/Public');
$value = $json->decode($input);
echo $input."<BR>";
var_dump($value);
echo "<br>";
echo $value->{'version'};
$input = file_get_contents('http://192.168.0.10:8080/cgi-bin/filemanager/utilRequest.cgi?func=createdir&sid=xxxxxxxx&dest_folder=test&dest_path=/Public');
$value = $json->decode($input);
echo $input."<BR>";
var_dump($value);
echo "<br>";
echo $value->{'version'};
출력
[1,2,"foo"]
{ "version": "4.1", "build": "20150126", "status": 3, "success": "true" }
object(stdClass)#2 (4) { ["version"]=> string(3) "4.1" ["build"]=> string(8) "20150126" ["status"]=> int(3) ["success"]=> string(4) "true" }
4.1
원본 데이터
{ "version": "4.1", "build": "20150126", "status": 3, "success": "true" }