Hello, there is the following XML (here is a small piece):

<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' 

You need to get the value of the default_car element. How can I get there?

    1 answer 1

    In fact, you need a piece of more to see the structure. In general, about here:

     <?php $xmlstr = "<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'/></init>"; $xml = simplexml_load_string($xmlstr); echo $xml->user[0]->attributes()->default_car; /* 59363292 */ ?> 
    • Thank you for responding. The problem has already been solved, and it is much simpler: $ out = file_get_contents ("URL to XML"); list ($ a, $ b) = explode ("default_car = '", $ out, 2); $ default_car = intval ($ b); - Vitali RS