Read a line from an XML file with PHP
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Here is my XML file

http://keywordorganizer.org/resources/app-resources/startup-messages.xml

I just want to read the version number (e.g. the number 2.26 -- here 2.26)

So on my CONTACT ME form, I can say "Make sure you have the latest version 2.26!"

Can you give me some php code that will read the version number from this xml file?

awarded to skram
Tags
PHP
xml

Crowdsource coding tasks.

1 Solution

Winning solution

Here you go - http://phpfiddle.org/lite/code/u7x-2sw (click "Run" to see the result)

hi thanks can you tell me how i would get it from the link though http://keywordorganizer.org/resources/app-resources/startup-messages.xml i can see how you did it from the string. but how would i do it from the actual file path?
tonloc over 7 years ago
Sure- just replace the $xmlstr assignment to $xmlstr = file_get_contents("http://keywordorganizer.org/resources/app-resources/startup-messages.xml");
skram over 7 years ago
(Full code: https://gist.github.com/marks/6329518)
skram over 7 years ago