I tried to read this json result :
stdClass Object (
[search-results] => stdClass Object
(
[opensearch:totalResults] => 1770323
[opensearch:startIndex] => 0
[opensearch:itemsPerPage] => 25
[opensearch:Query] => stdClass Object
(
[@role] => request
[@searchTerms] => gene
[@startPage] => 0
)
[link] => Array
(
[0] => stdClass Object
(
[@_fa] => true
[@href] => http://api.els.com/content/search/scidir?start=0&count=25&query=gene
[@ref] => self
[@type] => application/json
)
)
)
)
my code :
$json = file_get_contents($requete); // dans la variable json
$obj = json_decode($json);
echo $obj->search-results->link[0]; // (I tried also : $obj->{'search-results'}->link[0];
code error :
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ';' in
I don't understand where is my fault, please, have you an idea ? Thanks Jean