George Pitcher wrote:
Hi,
the likelyhood that someone will answer you question with anything relevant rapidly drops when you can't be bothered to start a new thread. this is because threaded news/list readers are, well, threaded and your post just got tagged onto the bottom of some, possibly totally uninteresting thread, that person X is ignoring. if you promise not to do it again I give you an answer that might help, a little. promise? ok then... :-)
My main site allows authenticated users to insert bibliographic data into our database. We ask them to start by putting in an ISBN or ISSN. Some documentes don't have them, or the use is too lazy to look for them. Rather than them entering jibberish, we first check that if they have entered something - that its mathematically correct (there's a algorithm to check these). Where they don't know the ISBN/ISSN, I would like them to enter their document title and then get my system to check the UK's main library biblio service (COPAC) and see if the title exists on their db. I've set up a simple cURL test which queries the COPAC site and displays the page as if it was from my site (not quite what I wanted - I'd rather have a list of ISBN/ISSNs and their associated titles without all the baggage). So my questions are: Is there a way for me to (using cURL) ask COPAC how many records match the search and if >0, return the data in a way that I can use it as I wish?
cURL is a tool for retrieving a resource from a URL.... so the question does COPAC offer a 'webservice' that returns 'raw' data? this has nothing to do with cURL at all, you can view cURL (although it a simplistic view as a webbrowser that you scripts can use) COPAC may or may noy offer a handy webservice, and it may be subscription based.
If not, is there another tool that I should be using?
probably the most powerful one you have, its between your ears and pisses over every other tool at your disposal :-) - chances are you are going to have to use cURL to return the relevant page to you script and then _parse_ the returned (x)HTML in order to determine what (if any relevant data was returned in the page) - such 'parsing' is often called screen-scraping .... probably you want to make use of either the preg_*() functions, the DOM extension (DOMXML extension if using php4) or SimpleXML extension in order to fish out the relevant data. If you do end up having to scrape out the data yourself you might consider sharing your code on hotscripts.com, phpclasses.org or whatever to save someone else the time to reinvent the wheel .. actually why not search some of the php related sites for code that does what you want - chances are someone has had to do this before.
MTIA George in Oxford (using a mix of NT4/XP by command of the company)
NT4? YPB (the middle word is 'Poor' ;-)
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php