PHP ile xml elemanını değiştirmek

0 Cevap php

Ben bu xml çıkışı var:

    <?xml version="1.0" encoding="UTF-8"?>
    <ysearchresponse xmlns="http://www.inktomi.com/" responsecode="200">
      <nextpage>/ysearch/news/v1/madonna?format=xml&amp;count=10&amp;appid=Zo5W4RbV34Fit1YXV.U6.wULh5WHjqh_XVB7Vutu0Z1gojo2sdv0hAlGoDVnUtSfZto-&amp;start=10</nextpage>
      <resultset_news count="10" start="0" totalhits="567" deephits="567">
        <result>
          <abstract>Is Madonna flexing her muscles at her former trainer, Tracy Anderson? The Material Girl recently announced a plan to open a series of Hard Candy...</abstract>
          <clickurl>http://lrd.yahooapis.com/_ylc=X3oDMTVjbXN2aXU4BF9TAzIwMjMxNTI3MDIEYXBwaWQDWm81VzRSYlYzNEZpdDFZWFYuVTYud1VMaDVXSGpxaF9YVkI3VnV0dTBaMWdvam8yc2R2MGhBbEdvRFZuVXRTZlp0by0EY2xpZW50A2Jvc3MEc2VydmljZQNCT1NTBHNsawN0aXRsZQRzcmNwdmlkA1N2Y2pHbUtJY3JxVDVqUnFZTEtpVnlURlJWcWlGRXpwSWRzQUFlN0w-/SIG=13nbl173k/**http%3A//www.nypost.com/p/pagesix/is_madonna_flexing_her_muscles_at_GrzN4FaNXrwcL5NiURPauO%3FCMP=OTC-rss%26FEEDNAME=</clickurl>
          <date>2010/11/15</date>
          <language>english</language>
          <source>New York Post</source>
          <sourceurl>http://www.nypost.com/</sourceurl>
          <time>06:47:42</time>
          <title>Madonna's gym revenge</title>
          <url>http://www.nypost.com/p/pagesix/is_madonna_flexing_her_muscles_at_GrzN4FaNXrwcL5NiURPauO?CMP=OTC-rss&amp;FEEDNAME=</url></result>
        <result>
</resultset_news></ysearchresponse>

hangi benim php kodu var:

    header("Content-type: text/xml");
//Gather data and prepare query
$thequery = urlencode($_GET['s']);
$yhost = 'http://boss.yahooapis.com';
$apikey = 'xxxxxxxxxxx';
$url = $yhost.'/ysearch/news/v1/'.$thequery.'?appid='.$apikey.'&format=xml';
//Get the results
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
curl_close($ch);
$results = new SimpleXmlElement($data, LIBXML_NOCDATA);
//echo the results
echo $results->asXML();

Ama ne yapmam gerekiyor "açıklaması" için "soyut" XML öğesi değiştirmek olduğunu. yani, yerine <abstract></abstract> i <description></description> Nasıl yapıyor hakkında gitmek istiyorsunuz olurdu?

0 Cevap