import.io によって生成された JSON からいくつかの値を出力する必要があります
これはJSONです:
object(stdClass)#1 (7) {
["offset"]=>
int(0)
["results"]=>
array(5) {
[0]=>
object(stdClass)#2 (3) {
["vanzare"]=>
string(6) "4.4400"
["moneda"]=>
string(3) "EUR"
["cumparare"]=>
string(6) "4.3550"
}
[1]=>
object(stdClass)#3 (3) {
["vanzare"]=>
string(6) "4.1882"
["moneda"]=>
string(3) "USD"
["cumparare"]=>
string(6) "4.0582"
}
[2]=>
object(stdClass)#4 (3) {
["vanzare"]=>
string(6) "6.1327"
["moneda"]=>
string(3) "GBP"
["cumparare"]=>
string(6) "5.9827"
}
[3]=>
object(stdClass)#5 (3) {
["vanzare"]=>
string(6) "4.2954"
["moneda"]=>
string(3) "CHF"
["cumparare"]=>
string(6) "4.1454"
}
[4]=>
object(stdClass)#6 (1) {
["moneda"]=>
string(3) "EUR"
}
}
["cookies"]=>
array(1) {
[0]=>
string(86) "CMSSESSID00f4b28b="6ch03433vc17dsah4khr28oie2";Path="/";Domain="www.bfer.ro";Port="80""
}
["connectorVersionGuid"]=>
string(36) "0ccdac3e-0887-4f73-9864-9b9ee3c0c66e"
["connectorGuid"]=>
string(36) "7d00ba0e-947c-403f-b33b-886a7ee2a300"
["pageUrl"]=>
string(35) "http://www.bfer.ro/ro/curs-valutar/"
["outputProperties"]=>
array(3) {
[0]=>
object(stdClass)#7 (2) {
["name"]=>
string(6) "moneda"
["type"]=>
string(6) "STRING"
}
[1]=>
object(stdClass)#8 (2) {
["name"]=>
string(9) "cumparare"
["type"]=>
string(6) "STRING"
}
[2]=>
object(stdClass)#9 (2) {
["name"]=>
string(7) "vanzare"
["type"]=>
string(6) "STRING"
}
}
}
上記の JSON は、次の PHP スクリプトによって生成されました。
<?php
$userGuid = "8f65f01f-c6bc-42a4-914d-879efd159abd";
$apiKey = "private";
// Issues a query request to import.io
function query($connectorGuid, $input, $userGuid, $apiKey) {
$url = "https://query.import.io/store/connector/" . $connectorGuid . "/_query?_user=" . urlencode($userGuid) . "&_apikey=" . urlencode($apiKey);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"import-io-client: import.io PHP client",
"import-io-client-version: 2.0.0"
));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array("input" => $input)));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
curl_close($ch);
return json_decode($result);
}
// Query for tile Curs Banca Comerciala Feroviara
$result = query("7d00ba0e-947c-403f-b33b-886a7ee2a300", array(
"webpage/url" => "http://www.bfer.ro/ro/curs-valutar/",
), $userGuid, $apiKey, false);
var_dump($result);
?>
2 番目の PHP スクリプトを使用して、この JSON から string(6) のみを出力する方法はありますか?たとえば、string(6) "4.3550"です。それ、どうやったら出来るの?