OpenLibrary.orgによって作成されたjsonを取得し、情報から新しい配列を再作成します。 OpenLibraryjsonへのリンク
これがjsonをデコードするための私のPHPコードです:
$barcode = "9781599953540";
function parseInfo($barcode) {
$url = "http://openlibrary.org/api/books?bibkeys=ISBN:" . $barcode . "&jscmd=data&format=json";
$contents = file_get_contents($url);
$json = json_decode($contents, true);
return $json;
}
私が作成しようとしている新しい配列は、次のようになります。
$newJsonArray = array($barcode, $isbn13, $isbn10, $openLibrary, $title, $subTitle, $publishData, $pagination, $author0, $author1, $author2, $author3, $imageLarge, $imageMedium, $imageSmall);
しかし、ISBN_13を取得して$ isbn13に保存しようとすると、エラーが発生します。
Notice: Undefined offset: 0 in ... on line 38
// Line 38
$isbn13 = $array[0]['identifiers']['isbn_13'];
そして、$ array [1]、[2]、[3]....を試しても同じことがわかります。私はここで何を間違っているのですか!O私は私の貴重な名前が同じではないかもしれないことを知っています、それはそれらが異なる機能にあるからです。
ご協力いただきありがとうございます。