Created
July 31, 2013 22:01
-
-
Save mbutler/6126584 to your computer and use it in GitHub Desktop.
OAI-PMH harvester for IRO.
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 | |
for ($i=0; $i<=137; $i++) { | |
$t = $i*100; | |
$url = "http://ir.uiowa.edu/do/oai/?verb=ListRecords&resumptionToken=3961284/document-export/".$t."//"; | |
$returned_content = get_data($url); | |
print_r($returned_content); | |
$target_file = 'iro.xml'; | |
file_put_contents($target_file, $returned_content, FILE_APPEND); | |
} | |
function get_data($url) { | |
$ch = curl_init(); | |
$timeout = 5; | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); | |
$data = curl_exec($ch); | |
curl_close($ch); | |
return $data; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment