title: I am getting "Notice: Undefined property: stdClass"
body: <p>I'm trying to get some data from a wikipedia API but i am receiving this message.</p>
  
  <p>Here is the PHP script with the small html form above:</p>
  
  <pre><code>    &lt;form action="" method="get"&gt;
      &lt;input type="text" name="busca"&gt;
      &lt;input type="submit" value="Busca"&gt;
  &lt;/form&gt;
  
  &lt;?php
  
      if($_GET['busca']){
          $api_url = "https://en.wikipedia.org/w/api.php?format=json&amp;action=query&amp;prop=extracts&amp;titles=".ucwords($_GET['busca']).".redirects=true";
          $api_url = str_replace(' ', '%20', $api_url);
  
          if($data = json_decode(file_get_contents($api_url))){
              foreach($data-&gt;query-&gt;pages as $key=&gt;$val){
                  $pageId = $key;
                  break;
              }
              $content = $data-&gt;query-&gt;pages-&gt;$pageId-&gt;extract;
  
              header('Content-Type:text/html; charset=utf-8');
              echo $content;
          }
          else{
              echo 'Nenhum resultado encontrado.';
          }
      }
  ?&gt;
  </code></pre>
  
  <p>So i get: </p>
  
  <blockquote>
    <p>Notice: Undefined property: stdClass::$extract in
    C:\xampp\htdocs\wiki\index.php on line 18</p>
  </blockquote>