IMPORTANT! The server may go down soon - possibly permanently. Please read the latest post in Announcements and News

I strongly advise all users using my server for their web site to make alternative arrangements.

Outgoing mail is disabled because of the malware on the server. No new forum registrations are currently possible, and mail to the forum administrator will not work.

Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

UK Tides API.

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
Toxic17
Posts: 698
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis VPro2 Plus
Operating System: Debian 9.5 Stretch
Location: Bangor, NI
Contact:

UK Tides API.

Postby Toxic17 » Wed Aug 08, 2018 9:45 pm

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
https://www.conligwx.org/pws/
https://twitter.com/conligwx
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

User avatar
beteljuice
Posts: 2484
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: UK Tides API.

Postby beteljuice » Wed Aug 08, 2018 9:58 pm

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
Toxic17
Posts: 698
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis VPro2 Plus
Operating System: Debian 9.5 Stretch
Location: Bangor, NI
Contact:

Re: UK Tides API.

Postby Toxic17 » Wed Aug 08, 2018 10:03 pm

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
https://www.conligwx.org/pws/
https://twitter.com/conligwx
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image


Return to “Saratoga Templates”

Who is online

Users browsing this forum: Google [Bot] and 3 guests