Advertisement
Guest User

Untitled

a guest
Jul 8th, 2019
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2.  
  3. defined('_JEXEC') or die('Restricted access');
  4.  
  5. use Joomla\CMS\Http\HttpFactory;
  6. use Joomla\Registry\Registry;
  7.  
  8. class ModFooHelper
  9. {
  10.     public function __construct()
  11.     {
  12.         $this->baseurl = 'https://www.eventbriteapi.com/v3/users/me/events?token=mytoken';
  13.     }
  14.  
  15.     public static function getEvents()
  16.     {
  17.         $httpOptions = [
  18.             'userAgent' => "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17\r\n"
  19.         ];
  20.  
  21.         $options = new Registry($httpOptions);
  22.         $http    = HttpFactory::getHttp($options);
  23.         $httpResult = $http->get($this->baseurl);
  24.  
  25.         $results = json_decode($httpResult->body);
  26.  
  27.         return $results;
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement