title: Getting Error : Invalid argument supplied for foreach()
body: <p>When i run my website it gives me an error :</p>
  
  <blockquote>
    <p>Warning: Invalid argument supplied for foreach()</p>
  </blockquote>
  
  <p>Here are some lines of code:</p>
  
  <pre><code>$grab=ngegrab('https://www.googleapis.com/youtube/v3/search?key='.$key.'&amp;part=snippet&amp;order=relevance&amp;maxResults=10&amp;q='.$qu.'&amp;pageToken='.$yesPage.'&amp;type=video'); 
  $json = json_decode($grab);
  $nextpage=$json-&gt;nextPageToken;
  $prevpage=$json-&gt;prevPageToken;
  if($json)
  {
  foreach ($json-&gt;items as $sam)
  }
  </code></pre>