title: Get JSON object from URL using PHP
body: <p>I have a URL that gives different responses in JSON. I need to get the response using PHP and display target_url.
  I did it successfully with this code.</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
          $content = file_get_contents(&quot;https://code.directadvert.ru/show.cgi?adp=5357330&amp;json=22&quot;);
          $content = utf8_encode($content);
          $result = json_decode($content, true);
          $url = $new['target_url'];
  
          foreach($result['news'] as $new) {
              echo $new['target_url'];
          }
  ?&gt;
  </code></pre>
  <p>But I get only one of two identical answers. And every time I have to receive it differently. What could be the problem?</p>