travelosteam / amara-client
O interpretare a clientului php pentru interogarea TO Amara
dev-main
2021-08-18 11:29 UTC
Requires
- php: ~7.0
- ext-soap: *
- illuminate/http: ^7.30
- illuminate/support: ^7.30
This package is not auto-updated.
Last update: 2025-01-03 03:30:19 UTC
README
Requirements
PHP 7.0 and later.
Composer
You can install the bindings via Composer. Run the following command:
composer require travelosteam/amara-client
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
Getting Started
Downloading Offers
use TravelOS\API\Suppliers\Amara\Clients\Offer use TravelOS\API\Suppliers\Amara\Clients\Soap\UserToken /* * $user, $pass, $code from Amara TO * $key from amara docs */ $token = new UserToken($user, $pass, $code, $key); $client = new Offer(); $client->setToken($token); $archive = $client->DownloadOffer(); $file = pathinfo($archive->FileName, PATHINFO_FILENAME); file_put_contents($file, $archive->FileContent);
Booking Offer
use TravelOS\API\Suppliers\Amara\Clients\Book use TravelOS\API\Suppliers\Amara\Clients\Soap\ReservationRequestInfo use TravelOS\API\Suppliers\Amara\Clients\Soap\UserToken /* * $user, $pass, $code from Amara TO * $key from amara docs */ $token = new UserToken($user, $pass, $code, $key); $client = new Book(); $client->setToken($token); $reservation = new ReservationRequestInfo(); // ... add reservation data try{ $client->verify($reservation); $info = $client->book($reservation); var_dump($info); } carch (\Exception $e){ echo $e->getMessage(); }