V
V
Vitalik_vlk2014-07-26 12:10:25
PHP
Vitalik_vlk, 2014-07-26 12:10:25

How to parse XML response from server?

In general, the task is to parse XML to a certain value.
The trick is that it comes in response to a request to the server and looks like this:

<init can_send_fuel='1' day='735440' user_agent=''><user default_car='59363292' tank='0' races_lost='0' gold='0' money='800' races_won='0' fuel_ts='1406212478' fuel_base='100' money_spent='3700''>

We need to get to the default_car element.
Save how to get there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin, 2014-07-26
@Vitalik_vlk

list($a, $b) = explode("default_car='", $xml, 2);
$default_car = intval($b);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question