title: PHP/CURL/JSON: assigning items to var
body: <p>I have this PHP code that works 100% and it displays the below results, however how can I use this data as individual items?</p>
  
  <p>I'm used to using things like :</p>
  
  <pre><code>$title = $data['selection3']['name']; 
  echo $title
  </code></pre>
  
  <p>But that doesn't work here. I'd like to be able to seperate each item and assign it a var so that I can build an ad with it.</p>
  
  <p>PHP Curl code:</p>
  
  <pre><code>&lt;?php
      function origin($projecttoken,$apikey,$format) {
          $ch = curl_init();
          $apiuri = 'https://www.parsehub.com/api/v2/projects/'.$projecttoken.'/last_ready_run/data?api_key='.$apikey.'&amp;format='.$format.'';
          curl_setopt($ch, CURLOPT_URL, $apiuri);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
          curl_setopt($ch,CURLOPT_ENCODING, '');
              if(curl_exec($ch) === false){
                  echo curl_error($ch) . '&lt;br /&gt;';
              }
          $data = curl_exec($ch);
          curl_close($ch);
          return($data);
      }
  ?&gt;
  
      &lt;pre&gt;
      &lt;?php
      print_r(origin('xxxxxx','xxxxxx','json'));
      ?&gt;
      &lt;/pre&gt;
  </code></pre>
  
  <p>The Results:</p>
  
  <pre><code>    {
   "selection3": [
    {
     "name": "Medal of Honor™ Pacific Assault",
     "url": "https://www.origin.com/usa/en-us/store/medal-of-honor/medal-of-honor-pacific-assault/standard-edition"
    },
    {
     "name": "Join the Fight for Freedom"
    },
    {
     "name": "This World War II shooter is On the House and yours to own totally free."
    },
    {
     "name": "FREE"
    },
    {
     "name": "Get It Now",
     "url": ""
    }
   ],
   "selection6": [
    {
     "name": "Battlefield 4™ Dragon's Teeth",
     "url": "https://www.origin.com/usa/en-us/store/battlefield/battlefield-4/expansion/battlefield-4-dragons-teeth"
    },
    {
     "name": "Upgrade Your Fight"
    },
    {
     "name": "Add this expansion to your library for free and dominate the battlefield. It's On the House! (Requires base game to play.)"
    },
    {
     "name": "FREE"
    },
    {
     "name": "Get It Now",
     "url": ""
    }
   ]
  }   
  </code></pre>