Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Array from XML

  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Array from XML

    I'm trying to customize a php library administration system to fit my needs. In the system, when I choose to add a book, I'm taken to a page asking to enter ISBN(ASIN). I type it and I accept, then I'm taken to a page to fill the rest of the info about the book. Well, the whole question is about lazyness: I need the system to check ISBNdb.com (a public ISBN database) for that book and fill the data for me. Till now, I've managed to check the information, but I'm an absolute newbie and I don't know how can I ask php to analyze the XML answer from ISDNdb and drop the information on an array. I don't even know how to define an array, indeed.
    XML answer is something like that:
    Code:
    <ISBNdb server_time="2007-03-05T01:40:40Z">
    <BookList total_results="1" page_size="10" page_number="1" shown_results="1">
    <BookData book_id="works_of_oscar_wilde" isbn="1851705384">
    <Title>Works of Oscar Wilde</Title>
    <TitleLong/>
    <AuthorsText>Oscar Wilde, Timothy Gaynor (Editor)</AuthorsText>
    <PublisherText publisher_id="senate">Senate</PublisherText>
    <Details dewey_decimal="" physical_description_text="800 pages" language="" edition_info="Unknown Binding; 1997-07-25" dewey_decimal_normalized="" lcc_number="" change_time="2007-03-05T00:10:26Z" price_time="2007-03-05T00:10:47Z"/>
    </BookData>
    </BookList>
    </ISBNdb>
    I need, then, to have the text between <Title> and </Title> in $o_livre->Title
    the one between <AuthorsText> and </AuthorsText> in $o_livre->AuthorsText
    the publisher in $o_livre->PublisherText
    the text after edition_info=" and before the ; (Unknown Binding) in $o_livre->Lieu
    and the date after the ; in $o_livre->ReleaseDate
    I'm calling to a function in the main php file this way:
    PHP Code:
    $o_livre=get_book_isbn($rechcode
    and the function, in functions.inc, is:
    PHP Code:
    function get_book_isbn($rechcode)
    {
    $return=readfile('http://isbndb.com/api/books.xml?access_key=XXXXXXXX&results=details&index1=isbn&value1='.$rechcode);
    return(
    $return);

    HELP PLEASE!
    Many thanks for your help!

  • #2
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adirondacks
    Posts
    516
    Thanks
    4
    Thanked 4 Times in 4 Posts
    heh I didn't know that existed
    I've been doing things the hard way

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adirondacks
    Posts
    516
    Thanks
    4
    Thanked 4 Times in 4 Posts
    nikemen, I think I saw this script over at amazon.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •