Using the example PHP

The Netatmo API is a set of webservices allowing developers and third parties to access Netatmo device's data.
jtienor
Posts: 11
Joined: 27 Oct 2012, 03:14

Re: Using the example PHP

Post by jtienor » 11 Nov 2012, 18:22

With your lines corrected:

An error happend while trying to retrieve your tokens : SSL certificate problem: unable to get local issuer certificate User does not have any devices

trosenblatt
Posts: 233
Joined: 18 Sep 2012, 12:18

Re: Using the example PHP

Post by trosenblatt » 12 Nov 2012, 09:51

Your curl certificate is not up to date please update it with this one.
http://curl.haxx.se/ca/cacert.pem
(http://curl.haxx.se/docs/sslcerts.html)

Have a good day.

Thomas.
Thomas Rosenblatt, Netatmo Team.

potsky
Posts: 101
Joined: 27 Nov 2012, 10:35

Re: Using the example PHP

Post by potsky » 27 Nov 2012, 10:41

Hello!

I wrote yesterday a widget for a project and it works fine.
I've done same fixes than trosenblatt :
- Max"
- $params was missing
- index [0] was missing too

GIven that I use a local proxy, I had this in the php API file NAApiClient.php

public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HEADER => TRUE,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'netatmoclient',
CURLOPT_HTTPHEADER => array("Accept: application/json"),
CURLOPT_PROXY => 'localhost',
CURLOPT_PROXYPORT => '3128',
);

and


curl_setopt_array($ch, $opts);
$result = curl_exec($ch);
if ($result === FALSE)
{
$e = new NACurlErrorType(curl_errno($ch), curl_error($ch));
curl_close($ch);
throw $e;
}
curl_close($ch);

$result = str_replace('HTTP/1.0','HTTP/1.1',$result);
$result = str_replace("HTTP/1.1 200 Connection established\r\n\r\n",'',$result);

// Split the HTTP response into header and body.
list($headers, $body) = explode("\r\n\r\n", $result);
$headers = explode("\r\n", $headers);
//Only 2XX response are considered as a success

jtienor
Posts: 11
Joined: 27 Oct 2012, 03:14

Re: Using the example PHP

Post by jtienor » 03 Dec 2012, 01:47

Thank you for all of the help guys! I wanted to let you know that I got this working. I had one last question, not a huge deal but I was wondering if there was a way to read the temperature in Fahrenheit rather than Celsius? Again, thanks for everyone's attention and assistance. I look forward to the opportunity of acquiring a third module as well in early 2013 and I'll be trying to integrate this with the new SmartThings devices that will be coming out later this year. Happy Holidays guys!

JasonRain
Posts: 3
Joined: 26 Feb 2013, 05:00

Re: Using the example PHP

Post by JasonRain » 26 Feb 2013, 05:02

It's possible to have a complete sample for php

_________________
WoW gold|Diablo 3 Gold|Runescape Gold|Guild Wars 2 gold

potsky
Posts: 101
Joined: 27 Nov 2012, 10:35

Re: Using the example PHP

Post by potsky » 26 Feb 2013, 07:56

JasonRain wrote:It's possible to have a complete sample for php
_________________
WoW gold|Diablo 3 Gold|Runescape Gold|Guild Wars 2 gold
Here viewtopic.php?f=5&t=958
Last edited by potsky on 29 Mar 2013, 09:11, edited 1 time in total.

Post Reply

Return to “Netatmo API”