Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

UK Tides API.

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
User avatar
ConligWX
Posts: 1573
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

UK Tides API.

Post by ConligWX »

I'm trying to get a new wxtidesuk page working but have run into some problem with the code.

the website supplies php code like so:

Code: Select all

<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://admiraltyapi.azure-api.net/uktidalapi/api/V1/Stations/{stationId}');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_GET);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
the problem is the

require_once 'HTTP/Request2.php';

which I do not have and it doesn't look like I can compile the PEAR module on my NAS. so is there an Alternative way around this?

https://admiraltyapi.portal.azure-api.net/
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: UK Tides API.

Post by beteljuice »

Well ... here is the PEAR module .. https://pear.php.net/package/HTTP_Request2 and all documentation.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
ConligWX
Posts: 1573
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: UK Tides API.

Post by ConligWX »

beteljuice wrote:Well ... here is the PEAR module .. https://pear.php.net/package/HTTP_Request2 and all documentation.
Thanks but I cannot install PEAR on the NAS.

cancel my last. just found pear on the NAS and managed to pull the data down.! :groan:
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
Post Reply