Note that there are some explanatory texts on larger screens.

plurals
  1. POphp parser xml with curl
    text
    copied!<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/561816/php-curl-extract-a-xml-response">PHP Curl , extract a XML response</a> </p> </blockquote> <p>How to php parser xml with curl? Here is my code, how to get xml each item values? Thanks.</p> <pre><code>&lt;?php define("EMAIL_ADDRESS", "youlichika@hotmail.com"); $ch = curl_init(); $cv = curl_version(); $user_agent = "curl ${cv['version']} (${cv['host']}) libcurl/${cv['version']} ${cv['ssl_version']} zlib/${cv['libz_version']} &lt;" . EMAIL_ADDRESS . "&gt;"; curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($ch, CURLOPT_ENCODING, "deflate, gzip, identity"); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPGET, TRUE); curl_setopt($ch, CURLOPT_URL, "http://en.wikipedia.org/w/api.php?action=opensearch&amp;search=tokyo&amp;format=xml&amp;limit=2"); $xml = curl_exec($ch); curl_close($ch); var_dump($xml); ?&gt; </code></pre> <p>XML TREE</p> <pre><code>&lt;SearchSuggestion version="2.0"&gt; &lt;Query xml:space="preserve"&gt;tokyo&lt;/Query&gt; &lt;Section&gt; &lt;Item&gt; &lt;Text xml:space="preserve"&gt;Tokyo&lt;/Text&gt; &lt;Description xml:space="preserve"&gt; , officially , is one of the 47 prefectures of Japan. &lt;/Description&gt; &lt;Url xml:space="preserve"&gt;http://en.wikipedia.org/wiki/Tokyo&lt;/Url&gt; &lt;Image source="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/Japan_Tokyo3.png/36px-Japan_Tokyo3.png" width="36" height="49"/&gt; &lt;/Item&gt; &lt;Item&gt; &lt;Text xml:space="preserve"&gt;Tokyo Broadcasting System&lt;/Text&gt; &lt;Description xml:space="preserve"&gt; (), TBS Holdings, Inc. or TBSHD, is a stockholding company in Tokyo, Japan. It is a parent company of a television network named and radio network named . &lt;/Description&gt; &lt;Url xml:space="preserve"&gt; http://en.wikipedia.org/wiki/Tokyo_Broadcasting_System &lt;/Url&gt; &lt;/Item&gt; &lt;/Section&gt; &lt;/SearchSuggestion&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload