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
Using the example PHP
-
- Posts: 233
- Joined: 18 Sep 2012, 12:18
Re: Using the example PHP
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.
http://curl.haxx.se/ca/cacert.pem
(http://curl.haxx.se/docs/sslcerts.html)
Have a good day.
Thomas.
Thomas Rosenblatt, Netatmo Team.
Re: Using the example PHP
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
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
Re: Using the example PHP
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!
Re: Using the example PHP
It's possible to have a complete sample for php
_________________
WoW gold|Diablo 3 Gold|Runescape Gold|Guild Wars 2 gold
_________________
WoW gold|Diablo 3 Gold|Runescape Gold|Guild Wars 2 gold
Re: Using the example PHP
Here viewtopic.php?f=5&t=958JasonRain wrote:It's possible to have a complete sample for php
_________________
WoW gold|Diablo 3 Gold|Runescape Gold|Guild Wars 2 gold
Last edited by potsky on 29 Mar 2013, 09:11, edited 1 time in total.