-5

this is my xml file,i do not known how to retrieve value from xml file using php,how to retrieve infromation from the xml file.if you known please help me.

  my xml file:
  see:http://en.wikipedia.org/w/api.php?  format=xml&action=query&titles=vikram&prop=revisions&rvprop=content


  <api>
  <query>
  <normalized>
   <n from="vikram" to="Vikram"/>
   </normalized>
   <pages>
   <page pageid="1034501" ns="0" title="Vikram">
    <revisions>
    <rev xml:space="preserve">
    '''Vikram''' may refer to: *[[Vikram (name)]], a male name in the Hindu  
    community *[[Vikramāditya]], a legendary king of India **Vikram, a character
   in   ''[[Baital Pachisi]]'', identified with Vikramāditya **[[Vikram Samvat]]
  (Vikram's Era, "V.S." or "B.S"), a popularly used calendar in India and the 
  official calendar of Nepal, established by Vikramaditya *[[Vikram Pandit]], 
  CitiGroup CEO *[[Vikram (actor)]], Vikram Kennedy, a Tamil-language Indian 
 film actor *[[Vikram Sarabhai]], an Indian scientist *[[Vikram 
 (film)|''Vikram'' (film)]], a 1986 Tamil-language Indian film *[[Vikram (1986 
 Telugu film)|''Vikram'' (1986 Telugu film)]], a 1986 Telugu-language Indian 
 film *[[Vikram Seth]], a bestselling author of Indian origin ;See also: *
 {{lookfrom|Vikram}} *{{intitle|Vikram}} {{disambig}}
 </rev>
 </revisions>
 </page>
 </pages>
 </query>
 </api>
SANSCLAW
  • 23
  • 1
  • 4
  • 15

2 Answers2

0

You can use PHP's native DomDocument or SimpleXML

benedict_w
  • 3,543
  • 1
  • 32
  • 49
  • @user1308746: this is not a site for getting people to write code for you. Please look at the resources that benedict_w has given you and try it out for yourself. Then if you have questions and issues with what you have tried. let us know – bretterer Apr 02 '12 at 19:38
0

You can use the xml_parse_into_struct() function for an easy to parse XML.

<?php
$simple = "<para><note>simple note</note></para>";
$p = xml_parser_create();
xml_parse_into_struct($p, $simple, $vals, $index);
xml_parser_free($p);
echo "Index array\n";
print_r($index);
echo "\nVals array\n";
print_r($vals);
?>

source

jarchuleta
  • 1,231
  • 8
  • 10