if ($jtitle) { $sr_data = new SherpaRomeo($jtitle, 'jtitle', $sherpa_romeo_key); $sr_responses[$sr_key] = $sr_data; } } } else { $sr_data = $sr_responses[$sr_key]; } $pubs = array_values($sr_data->getPublishers()); if (count($pubs) == 1) { $pub = $pubs[0]; $content_json->tags[] = array('tag' => 'SherpaRomeo Pre ' . $pub->getPreArchiving(), 'type' => 1); $content_json->tags[] = array('tag' => 'SherpaRomeo Post ' . $pub->getPreArchiving(), 'type' => 1); $content_json->tags[] = array('tag' => 'SherpaRomeo PDF ' . $pub->getPdfArchiving(), 'type' => 1); $client->setUri($url_base . 'items/' . $item_key . '?key=' . $zotero_key); $client->setHeaders('Content-Type', 'application/json'); $client->setHeaders('If-Match', $etag); $client->setRawData(json_encode($content_json)); $update_response = $client->request('PUT'); if (200 == $update_response->getStatus()) { echo "Update successful for " . $item_key . "\n"; } else { echo "Update failed (" . $update_response->getStatus() . ") for " . $item_key . "\n"; } } else { echo "Couldn't find single publisher for " . $item_key . "\n"; } } else { echo "No ISSN or publicationTitle for " . $item_key . "\n"; } }