Разбор XML-файла

Ответить
Crank174RuS
Сообщения: 66
Зарегистрирован: 19.09.2010
Есть код xml:

Код: Выделить всё

<data>
<missions> 
		<mission> 
			<id>1</id> 
			<x>130</x> 
			<y>260</y> 
			<missionText>...</missionText> 
			<allTick>5</allTick> 
			<completeTick>5</completeTick> 
			<necessaryEnergy>1</necessaryEnergy> 
 
			<requirements> 
				<!-- no data in 'value' --> 
			</requirements> 
 
			<rewards> 
				reward repeated="2" type="money" slot="3">10</reward> 
				<reward repeated="1" type="love" slot="2">1</reward> 
			</rewards> 
		</mission> 
		<mission> 
			<id>2</id> 
			<x>120</x> 
			<y>180</y> 
			<missionText>...</missionText> 
			<allTick>5</allTick> 
			<completeTick>5</completeTick> 
			<necessaryEnergy>3</necessaryEnergy> 
 
			<requirements> 
				<requirement type="build" slot="1">1</requirement> 
			</requirements> 
 
			<rewards> 
				<reward repeated="2" type="money" slot="3">20</reward> 
				<reward repeated="1" type="rating" slot="1">2</reward> 
				<reward repeated="1" type="love" slot="2">3</reward> 
			</rewards> 
		</mission> 
</data>
Как вывести из <id></id> по отдельности цифры 1 и 2?

Аватара пользователя
AgentSIB
Сообщения: 329
Зарегистрирован: 17.05.2010
Если файл:

Код: Выделить всё

$xml = simplexml_load_file($filename);
Если в переменной:

Код: Выделить всё

$xml = simplexml_load_string($filename);
И далее по примеру:

Код: Выделить всё

$missions = array();
foreach($xml->data->mission AS $mission){
    $missions[] = (string) $mission->id;
}
Видимо вообще не учишься?)
viewtopic.php?t=901&p=5523#p5523 - тут же вроде еще пояснял все :)
Frustra fit per plura quod potest fieri per pauciora © Закон "Бритвы Оккама"

Crank174RuS
Сообщения: 66
Зарегистрирован: 19.09.2010
Да не я выучил) Просто когда я делал у меня только одно число выводил.
Спасибо большое)

-- добавлено 22 авг 2011, 17:45 --

Только как сделать чтобы к примеру $mission1 выводило <id>1</id>, а $mission2 выводило <id>2</id>

Аватара пользователя
Distructor
Администратор
Сообщения: 1606
Зарегистрирован: 28.12.2009
Crank174RuS писал(а):чтобы к примеру $mission1 выводило <id>1</id>, а $mission2 выводило <id>2</id>
сейчас у тебя будет
$missions['0'] и $missions['1']

Crank174RuS
Сообщения: 66
Зарегистрирован: 19.09.2010
Distructor писал(а):сейчас у тебя будет
$missions['0'] и $missions['1']
Ошибку пишет:
Invalid argument supplied for foreach()

Аватара пользователя
AgentSIB
Сообщения: 329
Зарегистрирован: 17.05.2010
Пардон, моя вина

Код: Выделить всё

foreach($xml->data->mission AS $mission){
на

Код: Выделить всё

foreach($xml->data->missions AS $mission){
Мог бы и догадаться ;)
Frustra fit per plura quod potest fieri per pauciora © Закон "Бритвы Оккама"

Crank174RuS
Сообщения: 66
Зарегистрирован: 19.09.2010
Все равно (я так делал).
Вот сам код как я сделал может в нем проблема:

Код: Выделить всё

 $zeck = @file("ссылка на xml");
 $zeck_str = @implode("", $zeck);
 $xml = simplexml_load_string($zeck_str);

 $missions = array();
  foreach($xml->data->missions AS $mission){
    $missions[] = (string) $mission->id;
  }
 
echo "$missions[0]";

Аватара пользователя
Distructor
Администратор
Сообщения: 1606
Зарегистрирован: 28.12.2009
все что тебе нужно уже написано в теме..

Код: Выделить всё

$xml = simplexml_load_file("ссылка на xml");

$missions = array();
foreach($xml->data->missions AS $mission){
    $missions[] = (string) $mission->id;
}

echo $missions[0];
echo $missions[1];

Crank174RuS
Сообщения: 66
Зарегистрирован: 19.09.2010
Сделал. Но ошибка та же(

Код: Выделить всё

 $user = '142562331';
 $auth_key = '4ede5817a823e1055cb1a3691704b95f';
 $prison_url = 'http://109.234.157.38';



$xml = simplexml_load_file("$prison_url/prison/universal.php?getCityInfo&method=getCityInfo&city=1&user=$user&sig=1d3371b375dcb51f0624af7a054d729d&key=$auth_key");

$missions = array();
foreach($xml->data->missions AS $mission){
    $missions[] = (string) $mission->id;
}

echo $missions[0];
echo $missions[1];
-- добавлено 23 авг 2011, 11:46 --

Вот сама ссылка на xml:
109.234.157.38/prison/universal.php?getCityInfo&method=getCityInfo&city=1&user=41748801&
sig=1d3371b375dcb51f0624af7a054d729d&key=c88f530b1553094e3f13c68f13b70aea

Аватара пользователя
Distructor
Администратор
Сообщения: 1606
Зарегистрирован: 28.12.2009
Crank174RuS писал(а):Вот сама ссылка на xml:
ну вот открой свою ссылку и найди там хоть что-то похожее на изначально поставленный тобой вопрос =/

Crank174RuS
Сообщения: 66
Зарегистрирован: 19.09.2010
Ну там же ниже есть:

Код: Выделить всё

<missions> 
      <mission> 
         <id>1</id> 
         <x>130</x> 
         <y>260</y> 
         <missionText>...</missionText> 
         <allTick>5</allTick> 
         <completeTick>5</completeTick> 
         <necessaryEnergy>1</necessaryEnergy> 

         <requirements> 
            <!-- no data in 'value' --> 
         </requirements> 

         <rewards> 
            reward repeated="2" type="money" slot="3">10</reward> 
            <reward repeated="1" type="love" slot="2">1</reward> 
         </rewards> 
      </mission> 
      <mission> 
         <id>2</id> 
         <x>120</x> 
         <y>180</y> 
         <missionText>...</missionText> 
         <allTick>5</allTick> 
         <completeTick>5</completeTick> 
         <necessaryEnergy>3</necessaryEnergy> 

         <requirements> 
            <requirement type="build" slot="1">1</requirement> 
         </requirements> 

         <rewards> 
            <reward repeated="2" type="money" slot="3">20</reward> 
            <reward repeated="1" type="rating" slot="1">2</reward> 
            <reward repeated="1" type="love" slot="2">3</reward> 
         </rewards> 
      </mission> 
</missions>
-- добавлено 23 авг 2011, 21:23 --

Все сделал! Спасибо)
Вот так:

Код: Выделить всё

 $missions = array();
  foreach($xmls->missions->mission AS $mission){
    $missions[] = (string) $mission->id;
  }
-- добавлено 27 авг 2011, 14:05 --

Опять у меня руки кривые подводят)
Есть xml:

Код: Выделить всё

<friends> 
		<uid pos="1">18644054</uid> 
		<uid pos="2">2795146</uid> 
		<uid pos="3">51102465</uid> 
		<uid pos="4">3009979</uid> 
		<uid pos="5">20545632</uid> 
		<uid pos="6">3620068</uid> 
		<uid pos="7">4096770</uid> 
		<uid pos="8">33531306</uid> 
		<uid pos="9">71958398</uid> 
		<uid pos="10">14702834</uid> 
		<uid pos="11">40382867</uid> 
		<uid pos="12">85470946</uid> 
		<uid pos="13">10363815</uid> 
		<uid pos="14">32436342</uid> 
		<uid pos="15">49581461</uid> 
		<uid pos="16">41450803</uid> 
		<uid pos="17">96779323</uid> 
		<uid pos="18">12774723</uid> 
		<uid pos="19">94821776</uid> 
		<uid pos="20">40919143</uid> 
		<uid pos="21">11143799</uid> 
		<uid pos="22">9162324</uid> 
		<uid pos="23">14419051</uid> 
		<uid pos="24">17718737</uid> 
		<uid pos="25">31437983</uid> 
		<uid pos="26">35251579</uid> 
		<uid pos="27">9442824</uid> 
		<uid pos="28">11383941</uid> 
		<uid pos="29">12412368</uid> 
		<uid pos="30">54382905</uid> 
		<uid pos="31">12058534</uid> 
		<uid pos="32">5513810</uid> 
		<uid pos="33">76272520</uid> 
		<uid pos="34">14205355</uid> 
		<uid pos="35">57013302</uid> 
		<uid pos="36">3758005</uid> 
		<uid pos="37">2888471</uid> 
		<uid pos="38">21913898</uid> 
		<uid pos="39">22149625</uid> 
		<uid pos="40">38966022</uid> 
		<uid pos="41">8712807</uid> 
		<uid pos="42">12807214</uid> 
		<uid pos="43">14504887</uid> 
		<uid pos="44">41404846</uid> 
		<uid pos="45">64848172</uid> 
		<uid pos="46">19916339</uid> 
		<uid pos="47">19719084</uid> 
		<uid pos="48">32358767</uid> 
		<uid pos="49">18359068</uid> 
		<uid pos="50">1563428</uid> 
		<uid pos="51">7002802</uid> 
		<uid pos="52">1215811</uid> 
		<uid pos="53">62112235</uid> 
		<uid pos="54">4625437</uid> 
		<uid pos="55">21193721</uid> 
		<uid pos="56">10936070</uid> 
		<uid pos="57">7660186</uid> 
		<uid pos="58">15722934</uid> 
		<uid pos="59">112292692</uid> 
		<uid pos="60">8811783</uid> 
		<uid pos="61">4634405</uid> 
		<uid pos="62">8100961</uid> 
		<uid pos="63">4374119</uid> 
		<uid pos="64">106475803</uid> 
		<uid pos="65">2425216</uid> 
		<uid pos="66">1271333</uid> 
		<uid pos="67">65479110</uid> 
		<uid pos="68">5678985</uid> 
		<uid pos="69">6660334</uid> 
		<uid pos="70">98315078</uid> 
		<uid pos="71">10421739</uid> 
		<uid pos="72">45404265</uid> 
		<uid pos="73">53553624</uid> 
		<uid pos="74">92062327</uid> 
		<uid pos="75">19736342</uid> 
		<uid pos="76">9221636</uid> 
		<uid pos="77">52627132</uid> 
		<uid pos="78">5277033</uid> 
		<uid pos="79">16084642</uid> 
		<uid pos="80">8097779</uid> 
		<uid pos="81">106947906</uid> 
		<uid pos="82">8947584</uid> 
		<uid pos="83">15646776</uid> 
		<uid pos="84">20425022</uid> 
		<uid pos="85">47554328</uid> 
		<uid pos="86">16561791</uid> 
		<uid pos="87">14259390</uid> 
		<uid pos="88">7836657</uid> 
		<uid pos="89">116304536</uid> 
		<uid pos="90">8786835</uid> 
		<uid pos="91">46174649</uid> 
		<uid pos="92">4960128</uid> 
		<uid pos="93">3226242</uid> 
		<uid pos="94">43132993</uid> 
		<uid pos="95">41329868</uid> 
		<uid pos="96">45277329</uid> 
		<uid pos="97">12968603</uid> 
		<uid pos="98">15837437</uid> 
		<uid pos="99">3361227</uid> 
		<uid pos="100">17562597</uid> 
		<uid pos="101">3148814</uid> 
		<uid pos="102">83103618</uid> 
		<uid pos="103">1715655</uid> 
		<uid pos="104">10691214</uid> 
		<uid pos="105">49690559</uid> 
		<uid pos="106">31863791</uid> 
		<uid pos="107">3544322</uid> 
		<uid pos="108">5487425</uid> 
		<uid pos="109">3766680</uid> 
		<uid pos="110">7753374</uid> 
		<uid pos="111">51130322</uid> 
		<uid pos="112">31419266</uid> 
		<uid pos="113">4354204</uid> 
		<uid pos="114">13177630</uid> 
		<uid pos="115">32750493</uid> 
		<uid pos="116">86578434</uid> 
		<uid pos="117">10746383</uid> 
		<uid pos="118">4676918</uid> 
		<uid pos="119">3157225</uid> 
		<uid pos="120">51699086</uid> 
		<uid pos="121">1878261</uid> 
		<uid pos="122">3866450</uid> 
		<uid pos="123">1894038</uid> 
		<uid pos="124">3666316</uid> 
		<uid pos="125">30232837</uid> 
		<uid pos="126">34332133</uid> 
		<uid pos="127">13829375</uid> 
		<uid pos="128">57239449</uid> 
		<uid pos="129">63125069</uid> 
		<uid pos="130">2670954</uid> 
		<uid pos="131">14779267</uid> 
		<uid pos="132">6627406</uid> 
		<uid pos="133">39558007</uid> 
		<uid pos="134">33616554</uid> 
		<uid pos="135">1137348</uid> 
		<uid pos="136">100861583</uid> 
		<uid pos="137">47564219</uid> 
		<uid pos="138">10278387</uid> 
		<uid pos="139">5664774</uid> 
		<uid pos="140">7798152</uid> 
		<uid pos="141">20186944</uid> 
		<uid pos="142">14736368</uid> 
		<uid pos="143">116496729</uid> 
		<uid pos="144">1634805</uid> 
		<uid pos="145">55547929</uid> 
		<uid pos="146">18744669</uid> 
		<uid pos="147">8504136</uid> 
		<uid pos="148">15576232</uid> 
		<uid pos="149">11987801</uid> 
		<uid pos="150">3144506</uid> 
		<uid pos="151">50910856</uid> 
		<uid pos="152">50593147</uid> 
		<uid pos="153">7773695</uid> 
		<uid pos="154">10870131</uid> 
		<uid pos="155">2552274</uid> 
		<uid pos="156">5010933</uid> 
		<uid pos="157">1681962</uid> 
		<uid pos="158">67758478</uid> 
		<uid pos="159">51898958</uid> 
		<uid pos="160">9199952</uid> 
		<uid pos="161">13936308</uid> 
		<uid pos="162">91452698</uid> 
		<uid pos="163">122989494</uid> 
		<uid pos="164">125466883</uid> 
		<uid pos="165">55415288</uid> 
		<uid pos="166">9168868</uid> 
		<uid pos="167">14123092</uid> 
		<uid pos="168">5312539</uid> 
		<uid pos="169">52986388</uid> 
		<uid pos="170">14826214</uid> 
		<uid pos="171">30347780</uid> 
		<uid pos="172">17023290</uid> 
		<uid pos="173">5283366</uid> 
		<uid pos="174">1430670</uid> 
		<uid pos="175">7819827</uid> 
		<uid pos="176">4596426</uid> 
		<uid pos="177">27377403</uid> 
		<uid pos="178">14264519</uid> 
		<uid pos="179">4899066</uid> 
		<uid pos="180">5556371</uid> 
		<uid pos="181">53285305</uid> 
		<uid pos="182">18800151</uid> 
		<uid pos="183">16091214</uid> 
		<uid pos="184">26294027</uid> 
		<uid pos="185">4552609</uid> 
		<uid pos="186">228927</uid> 
		<uid pos="187">25003346</uid> 
		<uid pos="188">53468205</uid> 
		<uid pos="189">3252305</uid> 
		<uid pos="190">340231</uid> 
		<uid pos="191">29258987</uid> 
		<uid pos="192">4574201</uid> 
		<uid pos="193">14484159</uid> 
		<uid pos="194">4338777</uid> 
		<uid pos="195">30695933</uid> 
		<uid pos="196">14050463</uid> 
		<uid pos="197">77015872</uid> 
		<uid pos="198">7588138</uid> 
		<uid pos="199">3243029</uid> 
		<uid pos="200">11209810</uid> 
		<uid pos="201">36062876</uid> 
		<uid pos="202">9166432</uid> 
		<uid pos="203">2233986</uid> 
		<uid pos="204">33896793</uid> 
		<uid pos="205">15254483</uid> 
		<uid pos="206">4137043</uid> 
		<uid pos="207">122404103</uid> 
		<uid pos="208">26683761</uid> 
		<uid pos="209">3550721</uid> 
		<uid pos="210">4696839</uid> 
		<uid pos="211">8838083</uid> 
		<uid pos="212">43136709</uid> 
		<uid pos="213">1174143</uid> 
		<uid pos="214">99808512</uid> 
		<uid pos="215">52007796</uid> 
		<uid pos="216">12141155</uid> 
		<uid pos="217">75809733</uid> 
		<uid pos="218">2434056</uid> 
		<uid pos="219">18628987</uid> 
		<uid pos="220">34528595</uid> 
		<uid pos="221">8994105</uid> 
		<uid pos="222">89612316</uid> 
		<uid pos="223">29948820</uid> 
		<uid pos="224">28953715</uid> 
		<uid pos="225">6510554</uid> 
		<uid pos="226">33914363</uid> 
		<uid pos="227">70523919</uid> 
		<uid pos="228">65217539</uid> 
		<uid pos="229">5846891</uid> 
		<uid pos="230">23714824</uid> 
		<uid pos="231">40743450</uid> 
		<uid pos="232">37942433</uid> 
		<uid pos="233">26331902</uid> 
		<uid pos="234">56297053</uid> 
		<uid pos="235">88096729</uid> 
		<uid pos="236">3478858</uid> 
		<uid pos="237">12692279</uid> 
		<uid pos="238">8592816</uid> 
		<uid pos="239">1297948</uid> 
		<uid pos="240">1369129</uid> 
		<uid pos="241">1227047</uid> 
		<uid pos="242">5245136</uid> 
		<uid pos="243">19499646</uid> 
		<uid pos="244">14744971</uid> 
		<uid pos="245">59966476</uid> 
		<uid pos="246">6185048</uid> 
		<uid pos="247">4727428</uid> 
		<uid pos="248">45044227</uid> 
		<uid pos="249">3776441</uid> 
		<uid pos="250">70234919</uid> 
		<uid pos="251">4589584</uid> 
		<uid pos="252">6823403</uid> 
		<uid pos="253">9263411</uid> 
		<uid pos="254">11273625</uid> 
		<uid pos="255">19762171</uid> 
		<uid pos="256">20818243</uid> 
		<uid pos="257">888025</uid> 
		<uid pos="258">56194939</uid> 
		<uid pos="259">306677</uid> 
		<uid pos="260">64642750</uid> 
		<uid pos="261">1244001</uid> 
		<uid pos="262">8887345</uid> 
		<uid pos="263">34696738</uid> 
		<uid pos="264">13962646</uid> 
		<uid pos="265">1696051</uid> 
		<uid pos="266">55412771</uid> 
		<uid pos="267">8559407</uid> 
		<uid pos="268">24938180</uid> 
		<uid pos="269">3817428</uid> 
		<uid pos="270">24202800</uid> 
		<uid pos="271">28983460</uid> 
		<uid pos="272">5451856</uid> 
		<uid pos="273">19334477</uid> 
		<uid pos="274">906261</uid> 
		<uid pos="275">106139896</uid> 
		<uid pos="276">24706535</uid> 
		<uid pos="277">10073459</uid> 
		<uid pos="278">31811403</uid> 
		<uid pos="279">18837206</uid> 
		<uid pos="280">16317395</uid> 
		<uid pos="281">57061162</uid> 
		<uid pos="282">375587</uid> 
		<uid pos="283">88692536</uid> 
		<uid pos="284">1252827</uid> 
		<uid pos="285">18555156</uid> 
		<uid pos="286">14340032</uid> 
		<uid pos="287">1057747</uid> 
		<uid pos="288">46701372</uid> 
		<uid pos="289">227018</uid> 
		<uid pos="290">76656635</uid> 
		<uid pos="291">43367968</uid> 
		<uid pos="292">5711941</uid> 
		<uid pos="293">18811630</uid> 
		<uid pos="294">5930907</uid> 
		<uid pos="295">7693878</uid> 
		<uid pos="296">47436074</uid> 
		<uid pos="297">14062748</uid> 
		<uid pos="298">3029600</uid> 
		<uid pos="299">27199529</uid> 
		<uid pos="300">5418643</uid> 
		<uid pos="301">4055447</uid> 
		<uid pos="302">8623920</uid> 
		<uid pos="303">3175145</uid> 
		<uid pos="304">4356738</uid> 
		<uid pos="305">50240581</uid> 
		<uid pos="306">6853479</uid> 
		<uid pos="307">1487842</uid> 
		<uid pos="308">71103802</uid> 
		<uid pos="309">18239880</uid> 
		<uid pos="310">775333</uid> 
		<uid pos="311">3144238</uid> 
		<uid pos="312">530</uid> 
		<uid pos="313">28274545</uid> 
		<uid pos="314">9182629</uid> 
		<uid pos="315">54612973</uid> 
		<uid pos="316">12386525</uid> 
		<uid pos="317">5922604</uid> 
		<uid pos="318">6807906</uid> 
		<uid pos="319">12432520</uid> 
		<uid pos="320">84691393</uid> 
		<uid pos="321">62765188</uid> 
		<uid pos="322">85105571</uid> 
		<uid pos="323">35438351</uid> 
		<uid pos="324">82644016</uid> 
		<uid pos="325">104802115</uid> 
		<uid pos="326">7434240</uid> 
		<uid pos="327">21271933</uid> 
		<uid pos="328">3791481</uid> 
		<uid pos="329">15762626</uid> 
		<uid pos="330">9656992</uid> 
		<uid pos="331">11907045</uid> 
		<uid pos="332">44404109</uid> 
		<uid pos="333">63589145</uid> 
		<uid pos="334">12514784</uid> 
		<uid pos="335">2620206</uid> 
		<uid pos="336">63861664</uid> 
		<uid pos="337">18741628</uid> 
		<uid pos="338">2374260</uid> 
		<uid pos="339">1892450</uid> 
		<uid pos="340">120553083</uid> 
		<uid pos="341">5510450</uid> 
		<uid pos="342">47449162</uid> 
		<uid pos="343">77772772</uid> 
		<uid pos="344">1698572</uid> 
		<uid pos="345">10051077</uid> 
		<uid pos="346">5340127</uid> 
		<uid pos="347">37271620</uid> 
		<uid pos="348">7841729</uid> 
		<uid pos="349">53748083</uid> 
		<uid pos="350">35229260</uid> 
		<uid pos="351">3143059</uid> 
		<uid pos="352">13636430</uid> 
		<uid pos="353">48742426</uid> 
		<uid pos="354">4606786</uid> 
		<uid pos="355">38653957</uid> 
		<uid pos="356">55057780</uid> 
		<uid pos="357">116030468</uid> 
		<uid pos="358">2790407</uid> 
		<uid pos="359">44950</uid> 
		<uid pos="360">5225162</uid> 
		<uid pos="361">8293927</uid> 
		<uid pos="362">7304999</uid> 
		<uid pos="363">9348448</uid> 
		<uid pos="364">105854717</uid> 
		<uid pos="365">9080389</uid> 
		<uid pos="366">5768664</uid> 
		<uid pos="367">3156411</uid> 
		<uid pos="368">93296759</uid> 
		<uid pos="369">28379360</uid> 
		<uid pos="370">77101141</uid> 
		<uid pos="371">10283435</uid> 
		<uid pos="372">73279303</uid> 
		<uid pos="373">7897097</uid> 
		<uid pos="374">4072883</uid> 
		<uid pos="375">6860327</uid> 
		<uid pos="376">10745355</uid> 
		<uid pos="377">17362039</uid> 
		<uid pos="378">3097779</uid> 
		<uid pos="379">941286</uid> 
		<uid pos="380">1902382</uid> 
		<uid pos="381">1547013</uid> 
		<uid pos="382">13701091</uid> 
		<uid pos="383">15055446</uid> 
		<uid pos="384">20236077</uid> 
		<uid pos="385">39652484</uid> 
		<uid pos="386">87781639</uid> 
		<uid pos="387">6060728</uid> 
		<uid pos="388">2982622</uid> 
		<uid pos="389">87219976</uid> 
		<uid pos="390">13324914</uid> 
		<uid pos="391">16506999</uid> 
		<uid pos="392">8640346</uid> 
		<uid pos="393">91252430</uid> 
		<uid pos="394">4312932</uid> 
		<uid pos="395">86025423</uid> 
		<uid pos="396">30500819</uid> 
		<uid pos="397">987406</uid> 
		<uid pos="398">652524</uid> 
		<uid pos="399">4462322</uid> 
		<uid pos="400">34808671</uid> 
		<uid pos="401">12338359</uid> 
		<uid pos="402">7935860</uid> 
		<uid pos="403">12352591</uid> 
		<uid pos="404">10908172</uid> 
		<uid pos="405">23582658</uid> 
		<uid pos="406">23548575</uid> 
		<uid pos="407">359343</uid> 
		<uid pos="408">3364439</uid> 
		<uid pos="409">31714462</uid> 
		<uid pos="410">3119842</uid> 
		<uid pos="411">49442412</uid> 
		<uid pos="412">14406149</uid> 
		<uid pos="413">20401099</uid> 
		<uid pos="414">56801591</uid> 
		<uid pos="415">54395656</uid> 
		<uid pos="416">26049601</uid> 
		<uid pos="417">7357483</uid> 
		<uid pos="418">572443</uid> 
		<uid pos="419">94038964</uid> 
		<uid pos="420">10267682</uid> 
		<uid pos="421">263317</uid> 
		<uid pos="422">19769963</uid> 
		<uid pos="423">683181</uid> 
		<uid pos="424">18244636</uid> 
		<uid pos="425">43115574</uid> 
		<uid pos="426">1572211</uid> 
		<uid pos="427">2645975</uid> 
		<uid pos="428">59335185</uid> 
		<uid pos="429">280563</uid> 
		<uid pos="430">3142940</uid> 
		<uid pos="431">56931223</uid> 
		<uid pos="432">39583052</uid> 
		<uid pos="433">67377486</uid> 
		<uid pos="434">22056950</uid> 
		<uid pos="435">5972585</uid> 
		<uid pos="436">8046308</uid> 
		<uid pos="437">12335020</uid> 
		<uid pos="438">10116797</uid> 
		<uid pos="439">54798948</uid> 
		<uid pos="440">14696486</uid> 
		<uid pos="441">16540105</uid> 
		<uid pos="442">98370243</uid> 
		<uid pos="443">3126552</uid> 
		<uid pos="444">38162356</uid> 
		<uid pos="445">1416828</uid> 
		<uid pos="446">12233778</uid> 
		<uid pos="447">8554988</uid> 
		<uid pos="448">2687346</uid> 
		<uid pos="449">1837308</uid> 
		<uid pos="450">31623070</uid> 
		<uid pos="451">8600971</uid> 
		<uid pos="452">35330703</uid> 
		<uid pos="453">32057959</uid> 
		<uid pos="454">5278491</uid> 
		<uid pos="455">25458549</uid> 
		<uid pos="456">53752680</uid> 
		<uid pos="457">15398266</uid> 
		<uid pos="458">35283755</uid> 
		<uid pos="459">58894545</uid> 
		<uid pos="460">6378501</uid> 
		<uid pos="461">43133159</uid> 
		<uid pos="462">25694013</uid> 
		<uid pos="463">18035104</uid> 
		<uid pos="464">34327021</uid> 
		<uid pos="465">53060833</uid> 
		<uid pos="466">7214940</uid> 
		<uid pos="467">5363966</uid> 
		<uid pos="468">23159860</uid> 
		<uid pos="469">53721759</uid> 
		<uid pos="470">94184176</uid> 
		<uid pos="471">63635136</uid> 
		<uid pos="472">3801712</uid> 
		<uid pos="473">53432156</uid> 
		<uid pos="474">18290145</uid> 
		<uid pos="475">44617431</uid> 
		<uid pos="476">5621934</uid> 
		<uid pos="477">4674315</uid> 
		<uid pos="478">34770890</uid> 
		<uid pos="479">14771134</uid> 
		<uid pos="480">28664181</uid> 
		<uid pos="481">122807775</uid> 
		<uid pos="482">94514032</uid> 
		<uid pos="483">5344999</uid> 
		<uid pos="484">54667178</uid> 
		<uid pos="485">64564732</uid> 
		<uid pos="486">33164421</uid> 
		<uid pos="487">49796343</uid> 
		<uid pos="488">13994273</uid> 
		<uid pos="489">10870407</uid> 
		<uid pos="490">170030</uid> 
		<uid pos="491">45780007</uid> 
		<uid pos="492">37651634</uid> 
		<uid pos="493">12612651</uid> 
		<uid pos="494">1627090</uid> 
		<uid pos="495">106206</uid> 
		<uid pos="496">6311150</uid> 
		<uid pos="497">66345943</uid> 
		<uid pos="498">4925889</uid> 
		<uid pos="499">4403162</uid> 
		<uid pos="500">12524276</uid> 
		<uid pos="501">48338712</uid> 
		<uid pos="502">49569465</uid> 
		<uid pos="503">291504</uid> 
		<uid pos="504">34719137</uid> 
		<uid pos="505">90607403</uid> 
		<uid pos="506">10564775</uid> 
		<uid pos="507">36637035</uid> 
		<uid pos="508">97994125</uid> 
		<uid pos="509">5106619</uid> 
		<uid pos="510">23912233</uid> 
		<uid pos="511">20501683</uid> 
		<uid pos="512">112286258</uid> 
		<uid pos="513">2494883</uid> 
		<uid pos="514">8438804</uid> 
		<uid pos="515">85915704</uid> 
		<uid pos="516">4075359</uid> 
		<uid pos="517">23783774</uid> 
		<uid pos="518">36633275</uid> 
		<uid pos="519">2832760</uid> 
		<uid pos="520">53858523</uid> 
		<uid pos="521">47065715</uid> 
		<uid pos="522">25112336</uid> 
		<uid pos="523">21046471</uid> 
		<uid pos="524">66544319</uid> 
		<uid pos="525">14632581</uid> 
		<uid pos="526">143018</uid> 
		<uid pos="527">85217317</uid> 
		<uid pos="528">80766926</uid> 
		<uid pos="529">3947242</uid> 
		<uid pos="530">45427491</uid> 
		<uid pos="531">9196360</uid> 
		<uid pos="532">36228786</uid> 
		<uid pos="533">59019106</uid> 
		<uid pos="534">14791351</uid> 
		<uid pos="535">17638313</uid> 
		<uid pos="536">38483656</uid> 
		<uid pos="537">125599986</uid> 
		<uid pos="538">2603094</uid> 
		<uid pos="539">7341937</uid> 
		<uid pos="540">11623858</uid> 
		<uid pos="541">48704826</uid> 
		<uid pos="542">24413383</uid> 
		<uid pos="543">18334260</uid> 
		<uid pos="544">10818045</uid> 
		<uid pos="545">3639906</uid> 
		<uid pos="546">131314980</uid> 
		<uid pos="547">25943100</uid> 
		<uid pos="548">100800805</uid> 
		<uid pos="549">44721896</uid> 
		<uid pos="550">32408897</uid> 
		<uid pos="551">95753303</uid> 
		<uid pos="552">53447909</uid> 
		<uid pos="553">5757357</uid> 
		<uid pos="554">736316</uid> 
		<uid pos="555">11631269</uid> 
		<uid pos="556">7085820</uid> 
		<uid pos="557">35518498</uid> 
		<uid pos="558">34315655</uid> 
		<uid pos="559">15734989</uid> 
		<uid pos="560">78570367</uid> 
		<uid pos="561">30235509</uid> 
		<uid pos="562">6819569</uid> 
		<uid pos="563">102737390</uid> 
		<uid pos="564">5856589</uid> 
		<uid pos="565">1151010</uid> 
		<uid pos="566">132509341</uid> 
		<uid pos="567">29044663</uid> 
		<uid pos="568">7124577</uid> 
		<uid pos="569">92076671</uid> 
		<uid pos="570">74532656</uid> 
		<uid pos="571">8885699</uid> 
		<uid pos="572">26743147</uid> 
		<uid pos="573">7841695</uid> 
		<uid pos="574">2373452</uid> 
		<uid pos="575">53843927</uid> 
		<uid pos="576">94757124</uid> 
		<uid pos="577">714725</uid> 
		<uid pos="578">3702116</uid> 
		<uid pos="579">118190917</uid> 
		<uid pos="580">11177244</uid> 
		<uid pos="581">50239209</uid> 
		<uid pos="582">75257646</uid> 
		<uid pos="583">7487675</uid> 
		<uid pos="584">12973442</uid> 
		<uid pos="585">48856433</uid> 
		<uid pos="586">7487315</uid> 
		<uid pos="587">7391634</uid> 
		<uid pos="588">21028205</uid> 
		<uid pos="589">18329246</uid> 
		<uid pos="590">14044166</uid> 
		<uid pos="591">47912390</uid> 
		<uid pos="592">84794398</uid> 
		<uid pos="593">5359132</uid> 
		<uid pos="594">75351694</uid> 
		<uid pos="595">21520318</uid> 
		<uid pos="596">20743065</uid> 
		<uid pos="597">2301739</uid> 
		<uid pos="598">30384556</uid> 
		<uid pos="599">3057829</uid> 
		<uid pos="600">14477065</uid> 
		<uid pos="601">56268155</uid> 
		<uid pos="602">5459325</uid> 
		<uid pos="603">35131439</uid> 
		<uid pos="604">11571865</uid> 
		<uid pos="605">15041730</uid> 
		<uid pos="606">875014</uid> 
		<uid pos="607">134521593</uid> 
		<uid pos="608">966473</uid> 
		<uid pos="609">101893649</uid> 
		<uid pos="610">96722980</uid> 
		<uid pos="611">117673917</uid> 
		<uid pos="612">31864539</uid> 
		<uid pos="613">18925805</uid> 
		<uid pos="614">11066857</uid> 
		<uid pos="615">8715378</uid> 
		<uid pos="616">20630531</uid> 
		<uid pos="617">13761996</uid> 
		<uid pos="618">49783481</uid> 
		<uid pos="619">14073566</uid> 
		<uid pos="620">48707021</uid> 
		<uid pos="621">51781315</uid> 
		<uid pos="622">13576265</uid> 
		<uid pos="623">14091652</uid> 
		<uid pos="624">27515168</uid> 
		<uid pos="625">28427854</uid> 
		<uid pos="626">133899018</uid> 
		<uid pos="627">45201542</uid> 
		<uid pos="628">24163206</uid> 
		<uid pos="629">16492538</uid> 
		<uid pos="630">11057068</uid> 
		<uid pos="631">75268213</uid> 
		<uid pos="632">21699478</uid> 
		<uid pos="633">12504663</uid> 
		<uid pos="634">14966333</uid> 
		<uid pos="635">6955360</uid> 
		<uid pos="636">3874813</uid> 
		<uid pos="637">351058</uid> 
		<uid pos="638">5683781</uid> 
		<uid pos="639">91174094</uid> 
		<uid pos="640">81903582</uid> 
		<uid pos="641">14790576</uid> 
		<uid pos="642">44475073</uid> 
		<uid pos="643">22393793</uid> 
		<uid pos="644">18802879</uid> 
		<uid pos="645">5916035</uid> 
		<uid pos="646">2821712</uid> 
		<uid pos="647">9848670</uid> 
		<uid pos="648">7251718</uid> 
		<uid pos="649">626084</uid> 
		<uid pos="650">712213</uid> 
		<uid pos="651">31671904</uid> 
		<uid pos="652">48056211</uid> 
		<uid pos="653">1563308</uid> 
		<uid pos="654">87632716</uid> 
		<uid pos="655">26680497</uid> 
		<uid pos="656">30601429</uid> 
		<uid pos="657">21421616</uid> 
		<uid pos="658">56335135</uid> 
		<uid pos="659">52685674</uid> 
		<uid pos="660">39753416</uid> 
		<uid pos="661">52351276</uid> 
		<uid pos="662">67259991</uid> 
		<uid pos="663">27835087</uid> 
		<uid pos="664">9088504</uid> 
		<uid pos="665">91668176</uid> 
		<uid pos="666">64605744</uid> 
		<uid pos="667">91490180</uid> 
		<uid pos="668">109368309</uid> 
		<uid pos="669">83910849</uid> 
		<uid pos="670">7573477</uid> 
		<uid pos="671">6602153</uid> 
		<uid pos="672">52488161</uid> 
		<uid pos="673">14709002</uid> 
		<uid pos="674">136190998</uid> 
		<uid pos="675">8456639</uid> 
		<uid pos="676">101840489</uid> 
		<uid pos="677">109877914</uid> 
		<uid pos="678">36354997</uid> 
		<uid pos="679">54341512</uid> 
		<uid pos="680">5704781</uid> 
		<uid pos="681">358456</uid> 
		<uid pos="682">37143528</uid> 
		<uid pos="683">22164340</uid> 
		<uid pos="684">33417787</uid> 
		<uid pos="685">11903507</uid> 
		<uid pos="686">102849499</uid> 
		<uid pos="687">97081101</uid> 
		<uid pos="688">65536787</uid> 
		<uid pos="689">18097738</uid> 
		<uid pos="690">27577413</uid> 
		<uid pos="691">11805600</uid> 
		<uid pos="692">51744505</uid> 
		<uid pos="693">21547200</uid> 
		<uid pos="694">7760786</uid> 
		<uid pos="695">106364758</uid> 
		<uid pos="696">41281296</uid> 
		<uid pos="697">10526751</uid> 
		<uid pos="698">46736338</uid> 
		<uid pos="699">951981</uid> 
		<uid pos="700">39138188</uid> 
		<uid pos="701">35857702</uid> 
		<uid pos="702">70571791</uid> 
		<uid pos="703">109309192</uid> 
		<uid pos="704">109035728</uid> 
		<uid pos="705">5508438</uid> 
		<uid pos="706">71222307</uid> 
		<uid pos="707">1960615</uid> 
		<uid pos="708">71925689</uid> 
		<uid pos="709">12452650</uid> 
		<uid pos="710">13602079</uid> 
		<uid pos="711">52225260</uid> 
		<uid pos="712">25081962</uid> 
		<uid pos="713">36695079</uid> 
		<uid pos="714">41252055</uid> 
		<uid pos="715">85336593</uid> 
		<uid pos="716">43642553</uid> 
		<uid pos="717">117733601</uid> 
		<uid pos="718">41623582</uid> 
		<uid pos="719">14280924</uid> 
		<uid pos="720">8916685</uid> 
		<uid pos="721">50176173</uid> 
		<uid pos="722">13508397</uid> 
		<uid pos="723">13084284</uid> 
		<uid pos="724">1928355</uid> 
		<uid pos="725">42515759</uid> 
		<uid pos="726">2710757</uid> 
		<uid pos="727">2803692</uid> 
		<uid pos="728">17687399</uid> 
		<uid pos="729">53290868</uid> 
		<uid pos="730">46244528</uid> 
		<uid pos="731">23122137</uid> 
		<uid pos="732">12314769</uid> 
		<uid pos="733">787154</uid> 
		<uid pos="734">17145307</uid> 
		<uid pos="735">10528633</uid> 
		<uid pos="736">2459047</uid> 
		<uid pos="737">28925525</uid> 
		<uid pos="738">89377006</uid> 
		<uid pos="739">85654934</uid> 
		<uid pos="740">69327596</uid> 
		<uid pos="741">68127677</uid> 
		<uid pos="742">13637917</uid> 
		<uid pos="743">53016473</uid> 
		<uid pos="744">10243836</uid> 
		<uid pos="745">4906632</uid> 
		<uid pos="746">34148325</uid> 
		<uid pos="747">5685225</uid> 
		<uid pos="748">5865983</uid> 
		<uid pos="749">62138368</uid> 
		<uid pos="750">3862342</uid> 
		<uid pos="751">43303114</uid> 
		<uid pos="752">17191740</uid> 
		<uid pos="753">5903684</uid> 
		<uid pos="754">92281748</uid> 
		<uid pos="755">17721969</uid> 
		<uid pos="756">4660822</uid> 
		<uid pos="757">2819301</uid> 
		<uid pos="758">580313</uid> 
		<uid pos="759">13644222</uid> 
		<uid pos="760">95828004</uid> 
		<uid pos="761">279513</uid> 
		<uid pos="762">70867113</uid> 
		<uid pos="763">11853962</uid> 
		<uid pos="764">23306236</uid> 
		<uid pos="765">21725396</uid> 
		<uid pos="766">272033</uid> 
		<uid pos="767">2353076</uid> 
		<uid pos="768">37937539</uid> 
		<uid pos="769">12676762</uid> 
		<uid pos="770">112385797</uid> 
		<uid pos="771">13371992</uid> 
		<uid pos="772">86603506</uid> 
		<uid pos="773">30219923</uid> 
		<uid pos="774">85320097</uid> 
		<uid pos="775">52450718</uid> 
		<uid pos="776">55308206</uid> 
		<uid pos="777">58512954</uid> 
		<uid pos="778">125423550</uid> 
		<uid pos="779">6762799</uid> 
		<uid pos="780">16426711</uid> 
		<uid pos="781">88820462</uid> 
		<uid pos="782">25959737</uid> 
		<uid pos="783">95350265</uid> 
		<uid pos="784">98288156</uid> 
		<uid pos="785">53242888</uid> 
		<uid pos="786">55566019</uid> 
		<uid pos="787">49826251</uid> 
		<uid pos="788">8819527</uid> 
		<uid pos="789">5642820</uid> 
		<uid pos="790">5761797</uid> 
		<uid pos="791">8070054</uid> 
		<uid pos="792">8388701</uid> 
		<uid pos="793">4185655</uid> 
		<uid pos="794">17676303</uid> 
		<uid pos="795">90087188</uid> 
		<uid pos="796">29066500</uid> 
		<uid pos="797">1831888</uid> 
		<uid pos="798">11574648</uid> 
		<uid pos="799">50842877</uid> 
		<uid pos="800">22829130</uid> 
		<uid pos="801">61229636</uid> 
		<uid pos="802">39724977</uid> 
		<uid pos="803">2754329</uid> 
		<uid pos="804">7253192</uid> 
		<uid pos="805">86575560</uid> 
		<uid pos="806">11464871</uid> 
		<uid pos="807">33378087</uid> 
		<uid pos="808">57583581</uid> 
		<uid pos="809">75528124</uid> 
		<uid pos="810">110376263</uid> 
		<uid pos="811">22801265</uid> 
		<uid pos="812">23166321</uid> 
		<uid pos="813">42181918</uid> 
		<uid pos="814">92325847</uid> 
		<uid pos="815">6161521</uid> 
		<uid pos="816">73683833</uid> 
		<uid pos="817">4487858</uid> 
		<uid pos="818">7912446</uid> 
		<uid pos="819">18131459</uid> 
		<uid pos="820">31394424</uid> 
		<uid pos="821">91699478</uid> 
		<uid pos="822">7011191</uid> 
		<uid pos="823">3906632</uid> 
		<uid pos="824">12692791</uid> 
		<uid pos="825">4474428</uid> 
		<uid pos="826">48332519</uid> 
		<uid pos="827">112150353</uid> 
		<uid pos="828">696708</uid> 
		<uid pos="829">1270353</uid> 
		<uid pos="830">35693685</uid> 
		<uid pos="831">52639064</uid> 
		<uid pos="832">54080912</uid> 
		<uid pos="833">4133543</uid> 
		<uid pos="834">112868215</uid> 
		<uid pos="835">12946056</uid> 
		<uid pos="836">15196468</uid> 
		<uid pos="837">49554464</uid> 
		<uid pos="838">42547435</uid> 
		<uid pos="839">14221781</uid> 
		<uid pos="840">15614924</uid> 
		<uid pos="841">30212168</uid> 
		<uid pos="842">26233633</uid> 
		<uid pos="843">23896802</uid> 
		<uid pos="844">7255272</uid> 
		<uid pos="845">3223437</uid> 
		<uid pos="846">43663334</uid> 
		<uid pos="847">38502642</uid> 
		<uid pos="848">114958660</uid> 
		<uid pos="849">166756</uid> 
		<uid pos="850">25878161</uid> 
		<uid pos="851">48142226</uid> 
		<uid pos="852">8588852</uid> 
		<uid pos="853">54439117</uid> 
		<uid pos="854">3563277</uid> 
		<uid pos="855">5872</uid> 
		<uid pos="856">33126746</uid> 
		<uid pos="857">97160838</uid> 
		<uid pos="858">45335842</uid> 
		<uid pos="859">16657038</uid> 
		<uid pos="860">47116111</uid> 
		<uid pos="861">90481573</uid> 
		<uid pos="862">1234230</uid> 
		<uid pos="863">32801355</uid> 
		<uid pos="864">119580249</uid> 
		<uid pos="865">20845192</uid> 
		<uid pos="866">53217167</uid> 
		<uid pos="867">22805408</uid> 
		<uid pos="868">38063096</uid> 
		<uid pos="869">39074665</uid> 
		<uid pos="870">16297048</uid> 
		<uid pos="871">5486924</uid> 
		<uid pos="872">110198213</uid> 
		<uid pos="873">16750299</uid> 
		<uid pos="874">47482913</uid> 
		<uid pos="875">118196634</uid> 
		<uid pos="876">31674937</uid> 
		<uid pos="877">2897709</uid> 
		<uid pos="878">1295061</uid> 
		<uid pos="879">37755594</uid> 
		<uid pos="880">19950673</uid> 
		<uid pos="881">44201417</uid> 
		<uid pos="882">33796426</uid> 
		<uid pos="883">7716123</uid> 
		<uid pos="884">38931523</uid> 
		<uid pos="885">32830047</uid> 
		<uid pos="886">95242223</uid> 
		<uid pos="887">1583216</uid> 
		<uid pos="888">13798760</uid> 
		<uid pos="889">66695872</uid> 
		<uid pos="890">28833950</uid> 
		<uid pos="891">56301057</uid> 
		<uid pos="892">24787909</uid> 
		<uid pos="893">913522</uid> 
		<uid pos="894">37550869</uid> 
		<uid pos="895">9943908</uid> 
		<uid pos="896">6701440</uid> 
		<uid pos="897">10711705</uid> 
		<uid pos="898">45173517</uid> 
		<uid pos="899">3152305</uid> 
		<uid pos="900">103090628</uid> 
		<uid pos="901">12736772</uid> 
		<uid pos="902">73040200</uid> 
		<uid pos="903">117502611</uid> 
		<uid pos="904">36370707</uid> 
		<uid pos="905">35141166</uid> 
		<uid pos="906">23746638</uid> 
		<uid pos="907">102177971</uid> 
		<uid pos="908">1761810</uid> 
		<uid pos="909">1366657</uid> 
		<uid pos="910">66626062</uid> 
		<uid pos="911">17380192</uid> 
		<uid pos="912">21266488</uid> 
		<uid pos="913">9349423</uid> 
		<uid pos="914">3434234</uid> 
		<uid pos="915">14238062</uid> 
		<uid pos="916">65678892</uid> 
		<uid pos="917">2789718</uid> 
		<uid pos="918">57068772</uid> 
		<uid pos="919">43634298</uid> 
		<uid pos="920">11864168</uid> 
		<uid pos="921">520072</uid> 
		<uid pos="922">44017927</uid> 
		<uid pos="923">99516809</uid> 
		<uid pos="924">42701278</uid> 
		<uid pos="925">12302921</uid> 
		<uid pos="926">67797161</uid> 
		<uid pos="927">4760724</uid> 
		<uid pos="928">25617556</uid> 
		<uid pos="929">49089020</uid> 
		<uid pos="930">4619991</uid> 
		<uid pos="931">984317</uid> 
		<uid pos="932">78836407</uid> 
		<uid pos="933">109973815</uid> 
		<uid pos="934">11329544</uid> 
		<uid pos="935">10389424</uid> 
		<uid pos="936">12935267</uid> 
		<uid pos="937">65724432</uid> 
		<uid pos="938">41483755</uid> 
		<uid pos="939">15707919</uid> 
		<uid pos="940">3130129</uid> 
		<uid pos="941">30755722</uid> 
		<uid pos="942">128498384</uid> 
		<uid pos="943">80743141</uid> 
		<uid pos="944">43602120</uid> 
		<uid pos="945">101496429</uid> 
		<uid pos="946">30021920</uid> 
		<uid pos="947">49808486</uid> 
		<uid pos="948">79208314</uid> 
		<uid pos="949">29884305</uid> 
		<uid pos="950">5466048</uid> 
		<uid pos="951">33323826</uid> 
		...
	</friends> 
Нужно вывести данные из uid через запитую.
Делаю так:

Код: Выделить всё

$xmls = simplexml_load_file("ссылка");
foreach($xmls->friends->uid AS $uid){
$attr = $uid->attributes();
$fr_id[$attr['pos']] = intval($uid);
}
echo implode(', ', $fr_id);
Выводит ошибку: Warning: Illegal offset type
Ошибка в этой строке:

Код: Выделить всё

$fr_id[$attr['pos']] = intval($uid);
Что не так?? Подскажите.

Аватара пользователя
AgentSIB
Сообщения: 329
Зарегистрирован: 17.05.2010

Код: Выделить всё

$fr_id = array();
...
$fr_id[intval($attr['pos'])] = intval($uid);
Frustra fit per plura quod potest fieri per pauciora © Закон "Бритвы Оккама"

Crank174RuS
Сообщения: 66
Зарегистрирован: 19.09.2010
AgentSIB писал(а):

Код: Выделить всё

$fr_id = array();
...
$fr_id[intval($attr['pos'])] = intval($uid);
Спасибо большое) Как всегда выручил)

Ответить