2015-04-06 10:03:15 +00:00
|
|
|
<?php
|
|
|
|
//require_once('vendor/autoload.php');
|
2015-04-16 15:54:55 +00:00
|
|
|
require_once('SwaggerClient-php/SwaggerClient.php');
|
2015-04-06 10:03:15 +00:00
|
|
|
|
|
|
|
// initialize the API client
|
2015-05-22 14:09:51 +00:00
|
|
|
//$api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2');
|
|
|
|
//$api_client->addDefaultHeader("test1", "value1");
|
2015-05-19 07:33:03 +00:00
|
|
|
|
2015-05-26 15:20:34 +00:00
|
|
|
// to enable logging
|
|
|
|
//SwaggerClient\Configuration::$debug = true;
|
2015-05-26 15:52:35 +00:00
|
|
|
//SwaggerClient\Configuration::$debug_file = '/var/tmp/php_debug.log';
|
2015-05-26 15:20:34 +00:00
|
|
|
|
2015-04-16 15:54:55 +00:00
|
|
|
$petId = 10005; // ID of pet that needs to be fetched
|
2015-04-06 10:03:15 +00:00
|
|
|
try {
|
2015-05-22 14:09:51 +00:00
|
|
|
//$pet_api = new SwaggerClient\PetAPI($api_client);
|
|
|
|
$pet_api = new SwaggerClient\PetAPI();
|
2015-04-06 10:03:15 +00:00
|
|
|
// return Pet (model)
|
|
|
|
$response = $pet_api->getPetById($petId);
|
|
|
|
var_dump($response);
|
|
|
|
} catch (Exception $e) {
|
|
|
|
echo 'Caught exception: ', $e->getMessage(), "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|