Controller with external API only works on localhost

I’ve created a Site controller to use with the Eventbrite API. It works great on my localhost. But it doesn’t not work live.

Here is my controller:

    <?php  return function ($site, $pages, $page) {
$workshops = [];
$token = 'XXXX';
$organizer = XXXX;
$eburl = '' . $token . '&' . $organizer ;
$wurl = $eburl . '&subcategories=5999';
$wrequest = remote::request($wurl);
	if (!empty($wrequest->content)) {
	$workshops = json_decode($wrequest->content, true);
	$wid = $workshops['events'][0];
		$wmessage = '<em>There are currently no workshops scheduled. Be sure to join our <a href="#">mailing list</a> for the latest news.</em>';
 return compact('workshops',  'wmessage');

And here is my template:

<?php foreach($workshops['events'] as $workshop): ?>
 <li><a href="<?php echo $workshop['url'] ?>"></a> <?php echo $workshop['name']['text']</li>
<?php endforeach ?>	

There error I get when it’s on my remote server, is “Invalid argument supplied for foreach()”

I’m guessing that the endpoint[‘events’] is not being read. But can’t figure out why.

To try and debug this, remove the loop and replace with


and check what is gives you.

when I do any kind of dump, all I get is:

When I do a dump on my localhost, I get the full array with all the data