PHP version 5.3.21 MySQL version 5.1.70-cll
Note: I have posted on other forums but not getting any response so Im posting here in hopes of some feed back...
I have to compile an item catalog within mysql based on a large data feed that requires multiple calls to URLS that build on eachother in order to collect all the catalog data from the remote feed server.
I have been working with cURL and simpleXML and I have all my code written but it keeps timing out so I guess I have to look at xmlReader which I have never worked with. I have done several hours of research on xmlReader now but I have some concerns.
can someone please tell me - before I commit to xmlReader - if it can handle this and if xmlReader would be a wise choice in my case - Im mainly concerned about the nested loops here and having to call different URLS within each loop.
Open datafeed URL
Get list of Manufacturer ids using URL =http://acmedata.com/data/?do=getManufacturers
For each Manufacturer ID as $xx
*new reader object? Get list of Models ids using http://acmedata.com/data/?do=getModels?ManuID=$xx
Foreach Model ID as $yy
* new reader object? Get list of Products using URL http://acmedata.com/data/?do=getProducts?ManuID=$xx?ModelID=$yy
enter product attributes into mySQL....
Close foreach product
Close foreach model ID
Close for each Manufacturer
So Im just not sure if I close reader and re open with each new URL? I have not seen any examples of folks using foreach with xmlReader... Im concerned that I cant pull this off with xmlReader. Is there another option that would not exhaust my memory.
Thanks for any advice.
I don't think you can use for..each loops with XMLReader, but you can use a while loop and test to find the elements you need. This SPF thread has some code examples using XMLReader that you might find useful (check the code in the last few posts).
This topic is now closed. New replies are no longer allowed.