Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can just load the result into <code>SimpleXML</code> and loop over the data. Here's an example:</p> <pre><code>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_data = curl_exec($ch); curl_close($ch); // Make sure we actually have something to parse if($xml_data) { $parser = simplexml_load_string($xml_data); foreach($parser-&gt;Section as $section) { foreach($section-&gt;Item as $item) { echo "{$item-&gt;Text}\n\n{$item-&gt;Description}\n--------------------\n"; } } } </code></pre> <p>Here's some sample output:</p> <pre><code>$ php test.php Tokyo , officially , is one of the 47 prefectures of Japan. -------------------- Tokyo Broadcasting System (), 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 . -------------------- </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