-1

I use the Netatmo api to Show Data of my Netatmo in my Private php Page.

Code:

$password="xxxx";
$username="xxxx";
// Daten vom Entwickler Account der Netatmo Seite
$app_id = "xxxxx";
$app_secret = "xxxxxx";
// ------------------------------

$token_url = "https://api.netatmo.net/oauth2/token";
$postdata = http_build_query(
        array(
            'grant_type' => "password",
            'client_id' => $app_id,
            'client_secret' => $app_secret,
            'username' => $username,
            'password' => $password
    )
);

$opts = array('http' =>
    array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => $postdata
    )
);

$context  = stream_context_create($opts);
$response = file_get_contents($token_url, false, $context);

$params = null;
$params = json_decode($response, true);

$url_devices = "https://api.netatmo.net/api/getstationsdata?access_token=".$params['access_token'];
$resulat_device = file_get_contents($url_devices);  
$array = json_decode($resulat_device,true);

Result:

echo $temp_aus;

(will show the Temperature outside in C )

I want to show the echo as Text. So if its 10 C outside it shows text: its Cold outlide.

Any one have an idea?

Stultuske
  • 9,296
  • 1
  • 25
  • 37

1 Answers1

0

You need an if

if($temp_aus<=10){
     echo "Its cold outside";
}
else{
     echo "Not its cold outside";
}