Re: Parsing XML & Putting in MySQL
| From: | Stephen | Date: | Sat, 17 May 2003 19:51:20 +0000 |
| Subject: | Re: Parsing XML & Putting in MySQL | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148040@lists.php.net to get a copy of this message | ||
Thank you but how do I figure out if the page is trying to get the domains
right before purchasing or if they are just viewing their cart? I'd like to
use the same function for both times. I've put in my parser function only
(not the all the switch case things):
function parsexml($file) {
$fp = fopen($file, 'r');
if(!$fp) {
die('Unable to open URL for XML parsing');
}
$parser = xml_parser_create();
xml_set_element_handler($parser, 'startHandler', 'endHandler');
xml_set_character_data_handler($parser, 'contentHandler');
while ($data = fread($fp, 4096))
{
if (!xml_parse($parser, $data, feof($fp)))
{
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
xml_parser_free($parser);
}
I'm not yours, so why should I be sincere about it,
Stephen Craton
Senior Executive Web Developer
Mophus.com, Inc.
----- Original Message -----
From: "Manuel Lemos" <mlemos@acm.org>
To: "Stephen" <webmaster@melchior.us>
Cc: "PHP List" <php-general@lists.php.net>
Sent: Friday, May 16, 2003 8:27 PM
Subject: Re: Parsing XML & Putting in MySQL
Hello,
On 05/16/2003 09:40 PM, Stephen wrote:
> 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.
I think this may be what you are looking for:
Class: MySQL to XML - XML to MySQL
http://www.phpclasses.org/mysql_xml
--
Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/