Parsing XML & Putting in MySQL

From: Date: Sat, 17 May 2003 00:40:21 +0000
Subject: Parsing XML & Putting in MySQL
Groups: php.general 
Request: Send a blank email to php-general+get-147998@lists.php.net to get a copy of this message
I'm using an API that returns the information in XML format. I then turn this XML into HTML by parsing it using a parser I made. What I need to do is take a snapshot of their shopping cart right before they checkout and put the domain names they are purchasing (it's a domain name API system) into a database so they can view what they have purchased. The only problem I'm having is first determining whether they are just viewing their shopping cart to see what they have in it and then they might remove some from the time they purchase their domains. Here is a sample of a cart full of items before it is parsed by my script in XML: <?xml version="1.0" ?> - <interface-response> - <GetCartContent> - <item> <ItemID>376689</ItemID> <Description>Register</Description> <ProdType>10</ProdType> <Years>2</Years> <NameID>152544171</NameID> <Name>bobby.cc</Name> <StatusID>A</StatusID> <ItemPrice>24.95</ItemPrice> - <cd> <IsMailPak>0</IsMailPak> </cd> </item> - <item> <ItemID>376697</ItemID> <Description>Register</Description> <ProdType>10</ProdType> <Years>2</Years> <NameID>152544175</NameID> <Name>joedavison.net</Name> <StatusID>A</StatusID> <ItemPrice>8.95</ItemPrice> - <cd> <IsMailPak>0</IsMailPak> </cd> </item> - <item> <ItemID>376698</ItemID> <Description>Register</Description> <ProdType>10</ProdType> <Years>2</Years> <NameID>152544176</NameID> <Name>sadjfjr4.org</Name> <StatusID>A</StatusID> <ItemPrice>8.95</ItemPrice> - <cd> <IsMailPak>0</IsMailPak> </cd> </item> </GetCartContent> <Command>GETCARTCONTENT</Command> <ErrCount>0</ErrCount> <Server>RESELLERTEST</Server> <Site>eNom</Site> <IsLockable>True</IsLockable> <IsRealTimeTLD>True</IsRealTimeTLD> <Done>true</Done> - <debug> - <![CDATA[ ]]> </debug> </interface-response> I then parse it but that code is too long to paste in here. Basically I use a switch function to choose which tag it is and then echo out the opening and ending tags for each part. All I need to do is put what domain names a user has purchased and then later display them. I'm not yours, so why should I be sincere about it, Stephen Craton Senior Executive Web Developer Mophus.com, Inc.

« previous php.general (#147998) next »