title: Parse WikiPedia Introduction PHP
body: <p>I have read through other questions on this site - using the example answer given here - </p>
  
  <p><a href="https://stackoverflow.com/questions/5355155/wikipedia-api-get-parsed-introduction-only">wikipedia api: get parsed introduction only</a></p>
  
  <p>I have got to the stage where i get the first section of a wikipedia article back. But the first section includes pictures aswell as text. All i want is the text. here is the outputted html from my cURL response</p>
  
  <pre><code> $ Array
  (
  [parse] =&gt; Array
      (
          [text] =&gt; Array
              (
                  [*] =&gt; &lt;div class="dablink"&gt;This article is about sports known as    football.  For the ball used in these sports, see &lt;a href="/wiki/Football_(ball)"&gt;Football  (ball)&lt;/a&gt;.&lt;/div&gt; 
     &lt;div class="thumb tright"&gt; 
     &lt;div class="thumbinner" style="width:227px;"&gt;&lt;a href="/wiki/File:Football4.png"   class="image"&gt;&lt;img alt=""    src="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Football4.png/225px-   Football4.png" width="225" height="274" class="thumbimage" /&gt;&lt;/a&gt; 
     &lt;div class="thumbcaption"&gt; 
     &lt;div class="magnify"&gt;&lt;a href="/wiki/File:Football4.png" class="internal"  title="Enlarge"&gt;&lt;img src="http://bits.wikimedia.org/skins-1.17/common/images/magnify- clip.png" width="15" height="11" alt="" /&gt;&lt;/a&gt;&lt;/div&gt; 
     Some of the many different games known as football. From top left to bottom right:      &lt;a href="/wiki/Association_football"&gt;Association football&lt;/a&gt; or soccer, &lt;a   href="/wiki/Australian_rules_football"&gt;Australian rules football&lt;/a&gt;, &lt;a  href="/wiki/International_rules_football"&gt;International rules football&lt;/a&gt;, &lt;a  href="/wiki/Rugby_Union" class="mw-redirect" title="Rugby Union"&gt;Rugby Union&lt;/a&gt;, &lt;a  href="/wiki/Rugby_League" class="mw-redirect" title="Rugby League"&gt;Rugby League&lt;/a&gt;, and &lt;a  href="/wiki/American_Football" class="mw-redirect" title="American Football"&gt;American   Football&lt;/a&gt;.&lt;/div&gt; 
    &lt;/div&gt; 
    &lt;/div&gt; 
    &lt;p&gt;The game of &lt;b&gt;football&lt;/b&gt; is any of several similar &lt;a href="/wiki/Team_sport"  title="Team sport"&gt;team sports&lt;/a&gt;, of similar origins which involve advancing a ball into   a goal area in an attempt to score. Many of these involve &lt;a href="/wiki/Kick_(football)"  title="Kick (football)"&gt;kicking&lt;/a&gt; a ball with the foot to score a &lt;a  href="/wiki/Goal_(sport)" title="Goal (sport)"&gt;goal&lt;/a&gt;, though not all codes of football  using kicking as a primary means of advancing the ball or scoring. The most popular of these sports worldwide is &lt;a href="/wiki/Association_football"&gt;association football&lt;/a&gt;,   more commonly known as just "football" or "soccer". Unqualified, the word &lt;i&gt;&lt;a  href="/wiki/Football_(word)" title="Football (word)"&gt;football&lt;/a&gt;&lt;/i&gt; applies to whichever  form of football is the most popular in the regional context in which the word appears,  including &lt;a href="/wiki/American_football"&gt;American football&lt;/a&gt;, &lt;a href="/wiki/Australian_rules_football"&gt;Australian rules football&lt;/a&gt;, &lt;a  href="/wiki/Canadian_football"&gt;Canadian football&lt;/a&gt;, &lt;a  href="/wiki/Gaelic_football"&gt;Gaelic football&lt;/a&gt;, &lt;a href="/wiki/Rugby_league"&gt;rugby  league&lt;/a&gt;, &lt;a href="/wiki/Rugby_union"&gt;rugby union&lt;/a&gt; and other related games. These variations are known as "codes".&lt;/p&gt; 
      &lt;div class="toclimit-3"&gt;&lt;/div&gt; 
  </code></pre>
  
  <p>The code i actually want is located in the paragraph tags if thats any use? (starts with the words - "the game of"</p>
  
  <p>My url link that grabs the data in php is this - </p>
  
  <pre><code> 'http://en.wikipedia.org/w/api.php?action=parse&amp;page='.$search.'&amp;redirects=1&amp;format=json&amp;prop=text&amp;section=0'
  </code></pre>
  
  <p>Example code that i have tried - </p>
  
  <pre><code> &lt;?php
  
   include_once('simple_html_dom.php');
  
   $html = file_get_html('http://amazon.co.uk/');
  
   foreach($html-&gt;find('p') as $element)   
   {
   echo $element-&gt;plaintext . '&lt;br&gt;';
   }
  
   ?&gt;
  </code></pre>
  
  <p>This unfortunately returns a blank page</p>