PHP Classes

File: doc/example/neo.browse.php

Recommend this page to a friend!
  Classes of Sergii Pryz   NASA Near Earth Orbit API Client   doc/example/neo.browse.php   Download  
File: doc/example/neo.browse.php
Role: Example script
Content type: text/plain
Description: Example script
Class: NASA Near Earth Orbit API Client
Get near Earth orbit object data with NASA API
Author: By
Last change:
Date: 7 years ago
Size: 1,536 bytes
 

Contents

Class file image Download
<?php
namespace Picamator\NeoWsClient\Example;

/**
 * Resource: GET /rest/v1/neo/browse
 */

require_once 'app.php';
require_once
__DIR__ . '/template/neo.php';

use \
Picamator\NeoWsClient\Request\Data\NeoBrowseRequest;

/** @var \Picamator\NeoWsClient\Manager\Manager $manager */
$manager = $container->get('neo_ws_manager_neo_browse_manager');

// get response
$request = new NeoBrowseRequest(['page' => 1, 'size' => 5]);
$response = $manager->find($request);

/** @var \Picamator\NeoWsClient\Model\Api\Data\Component\NeoBrowseInterface $data */
$data = $response->getData();

echo <<<EOT
=================================
          NEO Browse
=================================

HTTP Code |
{$response->getCode()}
Api key limit |
{$response->getRateLimit()->getLimit()}
Api key remaining |
{$response->getRateLimit()->getRemaining()}


Page
----

Size |
{$data->getPage()->getSize()}
Total elements |
{$data->getPage()->getTotalElements()}
Total pages |
{$data->getPage()->getTotalPages()}
Number |
{$data->getPage()->getNumber()}


Links
-----
Prev |
{$data->getLink()->getPrev()}
Self |
{$data->getLink()->getSelf()}
Next |
{$data->getLink()->getNext()}


EOT;

/** @var \Picamator\NeoWsClient\Model\Api\Data\Component\NeoInterface $item */
foreach($data->getNeoList() as $item) {
   
showNeoDetailed($item);
}