title: Parsing json with php error "invalid argument supplied for foreach()"
body: <p>I have a problem with parsing a json feed with php and can not figure out what I am doing wrong.</p>
  
  <p><strong>JSON feed</strong></p>
  
  <pre><code>[{"id":10428167,"url":"some_url","amount":1197,"price":0.37,"seller":{"id":4682621,"name":"Rap17ka7a"}},
  {"id":10428466,"url":"some_url","amount":1450,"price":0.37,"seller":{"id":5031734,"name":"Meanor"}},
  {"id":10429969,"url":"some_url","amount":109,"price":0.37,"seller":{"id":5862543,"name":"djeisanborn"}}]
  </code></pre>
  
  <p><strong>PHP parser</strong></p>
  
  <pre><code>$request_url ="json_feed_url_is_here";
  $requests = file_get_contents($request_url);
  $response = json_decode($requests);
  foreach ($response as $item) {
  $seller = $item-&gt;seller-&gt;name;
  
  $seller = str_replace("'", "&amp;#39;", $seller);
  $seller = str_replace("’", "&amp;rsquo;;", $seller);
  
  
  $sql = ("INSERT INTO table_name ( ~~~cell names~~~) 
          VALUES (~~~cell values~~~, '$item-&gt;amount', '$item-&gt;price', '$item-&gt;url')") or  die('&lt;b&gt;Data Insert Error:&lt;/b&gt; ' . mysql_error());
  if (!mysql_query($sql,$con1))
    {
    die('Error: ' . mysql_error());
    }
  }
  </code></pre>
  
  <p><strong>What I get is this error:</strong></p>
  
  <pre><code>PHP Warning:  Invalid argument supplied for foreach() in path_to_php_file
  </code></pre>