PHP code example of abame / travel-payouts

1. Go to this page and download the library: Download abame/travel-payouts library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abame / travel-payouts example snippets


use TravelPayouts\Travel; 

$travel = new Travel('YOUR TOKEN HERE');

$ticketService = $travel->getTicketsService();
//Get flights found by our users in the last 48 hours from PAR to FRA. Return array consists of TravelPayouts\Ticket objects.
$flights = $ticketService->getLatestPrices('PAR', 'FRA', false, 'eur', 'year', 1, 10);

$flightService = $travel->getFlightService();
$flightService
       ->setIp('127.0.0.1')
       ->setHost('aviasales.ru')
       ->setMarker('123')
       ->addPassenger('adults', 2)
       ->addSegment('PAR', 'FRA', '2021-12-20');
$searchData    = $flightService->search('ru', 'Y');
$searchResults = $flightService->getSearchResults($searchData['search_id']);

$partnerService = $travel->getPartnerService();
//get user balance and currency of the balance
list($balance, $currency) = $partnerService->getBalance();

$dataService = $travel->getDataService();
//get all airports in the system
$airports    = $dataService->getAirports();