Hello

RM> Unfortunately I am trying to do this all via a php script on the 
RM> command line, not through a browser and while I may have to resort to 
RM> creating the file one way, saving it and feeding it to php to parse, I 
RM> was hoping to avoid that.

You could use the curl module in PHP to get the OAI file, and load it into 
a DOM or SimpleXML object or XML reader and get the IDs in a variety of 
ways.

Curl is slightly fiddly - I have a small function that wraps curl, so that 
it returns the contents of the URL - by default, it sends the URL contents 
straight to STDOUT.

function myCurl($url) {
    $data = "";
    $options = array(CURLOPT_URL => $url,
                     CURLOPT_RETURNTRANSFER => true);

    do {
        $c = curl_init();
        if (!$c) {
            break;
        }

        if (!curl_setopt_array($c, $options)) {
            break;
        }

        $data = curl_exec($c);
        curl_close($c);
    } while (false);

    return $data;
}

Or, if you can use file_get_contents with URLs, then use it instead.

Swithun.

-- 
The University of St Andrews is a charity registered in Scotland: SC013532


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to