Results 1 to 2 of 2
Aug 8, 2013, 18:51 #1
- Join Date
- Nov 2011
- 0 Post(s)
- 0 Thread(s)
xmlReader loop concerns / stackable multiple XMLs?
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 Reader 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 Foreach Product enter product attributes into mySQL.... Close foreach product Close foreach model ID Close for each Manufacturer Close Reader
Thanks for any advice.
Aug 9, 2013, 02:09 #2
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).