URL からの短い JSON ファイルがあります
https://api.crossref.org/works?query.title=Tuberculosis+drug&filter=type:journal-article,from-print-pub-date:2010,until-print-pub-date:2010&select=DOI&rows=3
このコードを使用して値total-results
のリストを取得しましたDOI
$crossref_api_url = 'https://api.crossref.org/works?query.title=Tuberculosis+drug&filter=type:journal-article,from-print-pub-date:2010,until-print-pub-date:2010&select=DOI&rows=2';
$JSON = file_get_contents($crossref_api_url);
$Array = json_decode($JSON, true);
$items_list = $message->items;
$totalItems = $message->total-results;
echo $totalItems;
for($i = 0; $i < count($items_list ); $i++) {
$doi = $items_list[$i]->items->DOI;
echo $doi;
}
結果が表示されます0
。totalItems
値がありません、DOI
リスト。
私のコードの間違いを見つけるのを手伝ってください。ありがとうございました