Jump to content

Recommended Posts

In the last couple of days i have been trying to pull some XML data from http://www.wowarmory.com/guild-info.xml?r=Jubei%27Thos&n=StRikEfOrCe&p=1.

 

All i want to do is pull every name in the character list and put them in a MYSQL database. i am consider myself good with php mysql and i can easily make info enter the database but i can figure out how to pull all the name in XML. i have been trying the attribute() function but it always comes up in an error.

 

If anyone could help me that would be great thanks.

Link to comment
https://forums.phpfreaks.com/topic/87289-pulling-xml-data/
Share on other sites

ty for the article but used some of their code just to see if it would run:

// Create an XML parser
$xml_parser = xml_parser_create();

// Set the functions to handle opening and closing tags
xml_set_element_handler($xml_parser, "startElement", "endElement");

// Set the function to handle blocks of character data
xml_set_character_data_handler($xml_parser, "characterData");

// Open the XML file for reading
$fp = fopen("http://www.sitepoint.com/rss.php","r")
       or die("Error reading RSS data.");

// Read the XML file 4KB at a time
while ($data = fread($fp, 4096))
   // Parse each 4KB chunk with the XML parser created above
   xml_parse($xml_parser, $data, feof($fp))
       // Handle errors in parsing
       or die(sprintf("XML error: %s at line %d",  
           xml_error_string(xml_get_error_code($xml_parser)),  
           xml_get_current_line_number($xml_parser)));

// Close the XML file
fclose($fp);

// Free up memory used by the XML parser
xml_parser_free($xml_parser);

 

and i came up with the errors:

Warning: xml_parse() [function.xml-parse]: Unable to call handler startElement() in /home/exacutio/public_html/frame/strike/test.php on line 37

Warning: xml_parse() [function.xml-parse]: Unable to call handler characterData() in /home/exacutio/public_html/frame/strike/test.php on line 37

Warning: xml_parse() [function.xml-parse]: Unable to call handler startElement() in /home/exacutio/public_html/frame/strike/test.php on line 37

Warning: xml_parse() [function.xml-parse]: Unable to call handler characterData() in /home/exacutio/public_html/frame/strike/test.php on line 37

 

it makes me think if my webhost is playing up or somthing

Link to comment
https://forums.phpfreaks.com/topic/87289-pulling-xml-data/#findComment-446516
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.