/    Sign up×
Community /Pin to ProfileBookmark

get elements from a XML file as variables

Hi am trying to get some entrys from a xml file:

[code]
<license>
<server_ip>some ip</server_ip>
<domain>some domain</domain>
<license_key>some license key</license_key>
<allowed>1000</allowed>
<used>1</used>
<expire>2100-12-31</expire>
<update>2014-12-31</update>
<check>1a1937f9e47ea3d1402749aae9a679c9</check>
</license>
[/code]

What I need is getting the entry’s in to variables that I can process with php to check license

[code]
$serverip = entry
$domain = entry
$license = entry
$expire = entry
$update = entry
$check = entry
[/code]

Some of the above is send to license server with CURL rest is just check in my config file.

Thanks in advance
Brian Olsen

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogApr 07.2014 — Sounds like a job for [url=http://php.net/simplexml]SimpleXML[/url]?
Copy linkTweet thisAlerts:
@sergey6116Apr 07.2014 — $file= file_get_contents("the_file_path_here");

$xml = new SimpleXmlElement($file);

$server_ip = $xml->license->server_ip;

Something like this.
×

Success!

Help @techboy992 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...