Created
January 9, 2024 20:12
-
-
Save ori229/3b3f249fd88276cecce02b6cd668dee3 to your computer and use it in GitHub Desktop.
Demo Alma's Update-Record API using PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = "https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/99374837900561?apikey=l7xx0e4..."; | |
echo "Calling $url ...\n"; | |
$curl = curl_init($url); | |
curl_setopt($curl, CURLOPT_URL, $url); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curl, CURLOPT_HEADER, FALSE); | |
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT'); | |
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml')); | |
$data = ' | |
<bib> | |
<record> | |
<leader>-----nam-a22-----z--4500</leader> | |
<controlfield tag="001">9912345678</controlfield> | |
<controlfield tag="008">161219uuuuuuuuuuuuuu-|-o----u|----|eng-d</controlfield> | |
<datafield ind1="1" ind2="0" tag="245"> | |
<subfield code="a">Hello World!</subfield> | |
</datafield> | |
</record> | |
</bib>'; | |
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); | |
$resp = curl_exec($curl); | |
curl_close($curl); | |
echo "Resp:\n"; | |
print_r($resp); | |
echo "\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment