Use the getAllPortfolioCompanies() method to retrieve all companies listed on the Uganda Securities Exchange:
index.php
<?phprequire_once 'PortfolioManager.php';$portfolioManager = new PortfolioManager();// Get all portfolio companies$allCompanies = $portfolioManager->getAllPortfolioCompanies();// Output the resultsecho $allCompanies;?>
This returns JSON data with company symbols, prices, and listing URLs.
Here’s a complete example that demonstrates all four main API methods:
<?phprequire_once 'PortfolioManager.php';// Create an instance$portfolioManager = new PortfolioManager();// 1. Get all portfolio companies$allCompanies = $portfolioManager->getAllPortfolioCompanies();echo "All Companies:\n";echo $allCompanies . "\n\n";// 2. Get details for a specific company (e.g., BOBU)$companyDetails = $portfolioManager->getCompanyDetails('BOBU');echo "Company Details for BOBU:\n";echo $companyDetails . "\n\n";// 3. Get historical data for a companyecho "Historical Data for BOBU:\n";$portfolioManager->getPortfolioCompanyData('BOBU');echo "\n\n";// 4. Get current exchange rates$exchangeRates = $portfolioManager->getExchangeRateDetails();echo "Exchange Rates:\n";echo $exchangeRates . "\n";?>