# API returns "username or password empty" response from localhost

**URL:** <https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950>\
**Category:** Emoncms\
**Tags:** api, input, php, temperature, emoncms\
**Created:** [22 October 2016 15:44 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950 "2016-10-22T15:44:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Beargie](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@Peter\_Beargie](https://community.openenergymonitor.org/u/Peter_Beargie)\
**Post date:** [22 October 2016 15:44 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/1 "2016-10-22T15:44:20Z")

</div>

I’m trying to send temperature from a DS18S20 sensor information to EMONCMS using a PHP script. The response is always the following json:  
{“success”:false,“message”:“Username or password empty”}

EMONCMS version is: low-write 9.7.5 | 2016.10.14

I’ve tried the following URLs with curl (where $EmonCMSApiKey is my read/write API key):

```nohighlight
$url = 'http://localhost/emoncms/input/post.json?node=19&csv=20875&apikey=' . $EmonCMSApiKey . '';
$url = 'http://localhost/emoncms/input/post.json?apikey=' . $EmonCMSApiKey . '&node=19&csv=20875';
$url = 'http://localhost/emoncms/input/post.json?node=19&json={20875}&apikey=' . $EmonCMSApiKey . '';
$url = 'http://localhost/emoncms/input/post.json?apikey=' . $EmonCMSApiKey . '&node=19&json={20875}';
$url = 'http://localhost/emoncms/input/post.json?node=19&json={"1":20875}&apikey=' . $EmonCMSApiKey . '';
$url = 'http://localhost/emoncms/input/post.json?apikey=' . $EmonCMSApiKey . '&node=19&json={"1":20875}';

```

When I use the URLs in a Firefox Browser from a different PC (replacing ‘localhost’ with the local IP) and while logged into the web interface, the data is logged correctly. Then again, those URLs work without the ApiKey when logged into the browser. It seems that it is only from the RaspberryPi itself that the URL does not work

I also tried adding the ApiKey to the POST data and the header with the same results:

```nohighlight
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $EmonCMSApiKey));
curl_setopt($ch, CURLOPT_POSTFIELDS, array('apiKey' => $EmonCMSApiKey));

```

As another test, I tried using wget in bash, but also the same results.

Any ideas why I can’t post to localhost?

thanks!

---

<div class="post-metadata">

**Author:** ![tsavikos](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/df788c/32.png) [@tsavikos](https://community.openenergymonitor.org/u/tsavikos)\
**Post date:** [22 October 2016 20:21 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/2 "2016-10-22T20:21:18Z")

</div>

Hi  
This works nicely in my case:

$url = ‘[http://192.168.0.132/emoncms/input/post.json?node=31&json=](http://192.168.0.132/emoncms/input/post.json?node=31&json=){Out\_Temp\_C:’ . $data[1] . ‘,Boiler\_temp\_C:’ . $data[5] . ‘}&apikey=yourownapi’;

Regards, Timo

---

<div class="post-metadata">

**Author:** ![tsavikos](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/t/df788c/32.png) [@tsavikos](https://community.openenergymonitor.org/u/tsavikos)\
**Post date:** [22 October 2016 20:27 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/3 "2016-10-22T20:27:15Z")

</div>

And then also:

$ch = curl\_init();  
curl\_setopt($ch, CURLOPT\_URL,$url);  
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);  
$contents = curl\_exec ($ch);  
curl\_close ($ch);

---

<div class="post-metadata">

**Author:** ![joyrider3774](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@joyrider3774](https://community.openenergymonitor.org/u/joyrider3774)\
**Post date:** [23 October 2016 20:44 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/4 "2016-10-23T20:44:30Z")

</div>

i’m using local version and providing apikey works without a problem for me in all my programs / components i created. It even works using curl both http get & http post so not sure what you do wrong i did notice your not always using lowercase (in your http post for example) for “apikey” but not sure if it would have an influence. I also noticed your providing double quotes like “1” which i’m not sure would work try just using 1. Also read/write it should always be write apikey with input api as your writing data and never be read api key. not sure what else, can’t realy test anythinf if you don’t provide the full php script to test myselve to see whats wrong.

---

<div class="post-metadata">

**Author:** ![Peter\_Beargie](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@Peter\_Beargie](https://community.openenergymonitor.org/u/Peter_Beargie)\
**Post date:** [25 October 2016 15:06 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/5 "2016-10-25T15:06:14Z")

</div>

Changing to the actual IP Address did the trick. Strange that localhost doesn’t work.

thanks.

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 18:00 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/6 "2016-11-01T18:00:30Z")

</div>

I seem to be having this same issue and for the life of my can’t see what I’m missing.

## script

```auto
<html>
<?php

//http://www.wunderground.com/weather/api/d/documentation.html

//Change the weather underground API and city below
//$json_string = file_get_contents("http://api.wunderground.com/api/xxxxxxx/geolookup/conditions/q/Canada/Edmonton.json");
$json_string = file_get_contents("http://api.wunderground.com/api/xxxxxxx/conditions/q/pws:IALBERTA120.json");
$parsed_json = json_decode($json_string);
$location = $parsed_json->{'current_observation'}->{'observation_location'}->{'city'};

$temp_c = $parsed_json->{'current_observation'}->{'temp_c'};
$windchill_c = $parsed_json->{'current_observation'}->{'windchill_c'};
$feelslike_c = $parsed_json->{'current_observation'}->{'feelslike_c'};
$relative_humidity = $parsed_json->{'current_observation'}->{'relative_humidity'};
$pressure_mb = $parsed_json->{'current_observation'}->{'pressure_mb'};
$wind_kph = $parsed_json->{'current_observation'}->{'wind_kph'};
$wind_gust_kph = $parsed_json->{'current_observation'}->{'wind_gust_kph'};
$dewpoint_c = $parsed_json->{'current_observation'}->{'dewpoint_c'};
$visibility_km = $parsed_json->{'current_observation'}->{'visibility_km'};
$precip_1hr_metric = $parsed_json->{'current_observation'}->{'precip_1hr_metric'};
$precip_today_metric = $parsed_json->{'current_observation'}->{'precip_today_metric'};

echo nl2br ("Current temperature in ${location} is: ${temp_c}\n");
echo nl2br ("Current relative humidity in ${location} is: ${relative_humidity}\n");
echo nl2br ("Current pressure in ${location} is: ${pressure_mb}\n");
echo nl2br ("Current wind speed in ${location} is: ${wind_kph}\n");

//Change the URL and EmonCMS API below

$url = 'http://192.168.1.15/emoncms/input/post.json?node=2&json={humidity:' . $relative_humidity . ',pressure:' . $pressure_mb . ',wind:' . $wind_kph . ',temp:' . $temp_c .',dewpoint:' . $dewpoint_c . ',visibilit
y:' . $visibility_km . ',rain:' . $precip_1hr_metric . ',windchill:' . $windchill_c . ',feelslike:' . $feelslike_c . ',windgust:' . $wind_gust_kph . ',raintoday:' . $precip_today_metric . '}&apikey=XXXXXXXX';

echo $url;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_POST, 1);
//curl_setopt($ch, CURLOPT_POSTFIELDS, "");
$contents = curl_exec ($ch);
curl_close ($ch);
echo $contents

?>
</html>

```

## Output

```auto
<html>
Current temperature in Aspen Crescent, Edmonton is: 0.2<br />
Current relative humidity in Aspen Crescent, Edmonton is: 93%<br />
Current pressure in Aspen Crescent, Edmonton is: 1010<br />
Current wind speed in Aspen Crescent, Edmonton is: 0<br />
http://192.168.1.15/emoncms/input/post.json?node=2&json={humidity:93%,pressure:1010,wind:0,temp:0.2,dewpoint:-1,visibility:N/A,rain: 0,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=XXXXXXXXX{"success":false,"message":"Username or password empty"}</html>

```

## Server Info

Emoncms Version 9.7.7 | 2016.10.29  
PHP Version 5.6.27-0+deb8u1 (Zend Version 2.6.0)  
Redis Version 2.8.17  
HTTP Server Apache/2.4.10 (Raspbian) HTTP/1.1 CGI/1.1 80  
Database Version MySQL 5.5.52-0+deb8u1

If I drop the $url into a browser: SUCCESS

```auto
192.168.1.58 - - [01/Nov/2016:11:46:22 -0600] "GET /emoncms/input/post.json?node=2&json={humidity:92%,pressure:1010,wind:0,temp:0.1,dewpoint:-1,visibility:N/A,rain:%200,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=XXXXXXXXXHTTP/1.1" 200 245 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36"

```

From php script: FAILURE

```auto
192.168.1.15 - - [01/Nov/2016:11:50:13 -0600] "GET /emoncms/input/post.json?node=2&json={humidity:93%,pressure:1010,wind:0,temp:0.2,dewpoint:-1,visibility:N/A,rain: 0,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=XXXXXXXHTTP/1.1" 200 412 "-" "-"

```

Thank you for the help!!

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 18:02 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/7 "2016-11-01T18:02:31Z")

</div>

emonhub reports the following when successful but has done this since the beginning, nothing on a failure

2016-11-01 14:40:40.425|ERROR|input\_controller.php|Format error, json value is not numeric  
2016-11-01 16:01:08.239|ERROR|input\_controller.php|Format error, json value is not numeric  
2016-11-01 17:46:22.599|ERROR|input\_controller.php|Format error, json value is not numeric

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [1 November 2016 18:16 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/8 "2016-11-01T18:16:52Z")

</div>

Are you definitely using the correct emoncms readwrite apikey?

Are you logged into emoncms in the browser, at the time you test the url?

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 18:17 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/9 "2016-11-01T18:17:48Z")

</div>

Hi Paul,

Yes - definately the correct apikey  
Yes - I am logged into the emoncms in the browser when I test the url

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [1 November 2016 18:19 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/10 "2016-11-01T18:19:17Z")

</div>

Is the url still successful if you log out or open an incognito browser window to try it?

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 18:21 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/11 "2016-11-01T18:21:31Z")

</div>

from a incognito is sucessful

192.168.1.58 - - [01/Nov/2016:12:20:11 -0600] “GET /emoncms/input/post.json?node=2&json={humidity:93%,pressure:1010,wind:0,temp:0.2,dewpoint:-1,visibility:N/A,rain:%200,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=XXXXXX HTTP/1.1” 200 245 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36”

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [1 November 2016 18:27 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/12 "2016-11-01T18:27:18Z")

</div>

Is the IP intentionally different? I wondered if you have more than 1 emoncms instance and the apikey is for 192.168.1.58/emoncms not 192.168.1.15/emoncms.

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 18:28 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/13 "2016-11-01T18:28:15Z")

</div>

192.168.1.58 is the client/desktop  
192.168.1.15 is the raspi/emoncms

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 18:32 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/14 "2016-11-01T18:32:06Z")

</div>

The weird this is this has been running solid for the last 2yrs or more and recently it just stopped working. No updates were applied and I was running 9.31. Noticed I was losing data and figured I would update to the latest. Everything else is updating and working correctly.

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [1 November 2016 18:35 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/15 "2016-11-01T18:35:49Z")

</div>

> [@cbwonderboy](#):
>
> 192.168.1.58 is the client/desktop  
> 192.168.1.15 is the raspi/emoncms

That’s thrown me, what am I missing? why are you testing a url is good using a different IP?

Does the url work for 192.168.1.15 in the browser?

Do you have 2 emoncms’s? if so do they have the same apikeys?

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 18:39 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/16 "2016-11-01T18:39:15Z")

</div>

Sorry Paul,

My raspi/emoncms is headless so I test from my desktop 192.168.1.58.

Below, the log shows 192.168.1.15 (raspi/emoncms) since the script is run locally and from 192.168.1.58 (desktop) when I post it via the browser. I’ll leave the apikey in so you can see.

192.168.1.15 - - [01/Nov/2016:11:44:32 -0600] “POST /emoncms/input/post.json?node=2&json={humidity:92%,pressure:1010,wind:0,temp:0.1,dewpoint:-1,visibility:N/A,rain: 0,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=913f557706d069745bfe8dac70040261 HTTP/1.1” 200 412 “-” “-”  
192.168.1.58 - - [01/Nov/2016:11:46:22 -0600] “GET /emoncms/input/post.json?node=2&json={humidity:92%,pressure:1010,wind:0,temp:0.1,dewpoint:-1,visibility:N/A,rain:%200,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=913f557706d069745bfe8dac70040261 HTTP/1.1” 200 245 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36”  
192.168.1.15 - - [01/Nov/2016:11:50:13 -0600] “GET /emoncms/input/post.json?node=2&json={humidity:93%,pressure:1010,wind:0,temp:0.2,dewpoint:-1,visibility:N/A,rain: 0,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=913f557706d069745bfe8dac70040261 HTTP/1.1” 200 412 “-” “-”

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [1 November 2016 18:51 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/17 "2016-11-01T18:51:42Z")

</div>

Ahh ok the penny drops, they are “from” not “to” urls.

So for clarity, when entering the “.15” url

```auto
http://192.168.1.15/emoncms/input/post.json?node=2&json={humidity:93%,pressure:1010,wind:0,temp:0.2,dewpoint:-1,visibility:N/A,rain: 0,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=XXXXXXXXX 

```

directly into an incognito browser on the desktop (.58) it is successful.

Can you successfully “ping” 192.168.1.15 from the pi commandline? Well I guess actually you must be able to, as you are getting the “username or password empty error”. that’s bizarre!

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 18:57 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/18 "2016-11-01T18:57:57Z")

</div>

Correct 🙂

if I ping using pi - I get icmp open socket:Operation not permitted

If I sudo ping - I get responses

Would this have anything to do with ufw being installed ? Just guessing…

I followed below for install: (FYI)

> **[emoncms/docs/RaspberryPi at master · emoncms/emoncms](https://github.com/emoncms/emoncms/tree/master/docs/RaspberryPi)**
>
> master/docs/RaspberryPi

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 18:59 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/19 "2016-11-01T18:59:58Z")

</div>

pi@emoncms:~ $ ping 192.168.1.15  
ping: icmp open socket: Operation not permitted  
pi@emoncms:~ $ sudo ping 192.168.1.15  
PING 192.168.1.15 (192.168.1.15) 56(84) bytes of data.  
64 bytes from 192.168.1.15: icmp\_seq=1 ttl=64 time=0.224 ms  
64 bytes from 192.168.1.15: icmp\_seq=2 ttl=64 time=0.180 ms

---

<div class="post-metadata">

**Author:** ![cbwonderboy](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@cbwonderboy](https://community.openenergymonitor.org/u/cbwonderboy)\
**Post date:** [1 November 2016 19:02 UTC](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950/20 "2016-11-01T19:02:24Z")

</div>

found the answer to the ping issue:

known bug in one of the recent releases. You can fix it with “sudo chmod u+s /bin/ping”. Then ping should work.

* * *

Hi Guys,

Is there anymore information I can gather to find out why this doesn’t work, enable any additional logs?

Hi Bill,

Thanks I’ll try that, but the entire $url works if I paste into a browser window and updates the input correctly, you think its a format issue?

I’ll try and report back.

* * *

This inability to post is a pain lol

* * *

Hi Bill - no change doing each entry or with POSTFIELDS  
Hi Paul - no worries Thank you for the Help

Here is the response from wget:  
pi@emoncms:~ $ wget -O - “[http://192.168.1.15/emoncms/input/post.json?node=2&json=](http://192.168.1.15/emoncms/input/post.json?node=2&json=){humidity:93%,pressure:1010,wind:0,temp:0.2,dewpoint:-1,visibility:N/A,rain: 0,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=913f557706d069745bfe8dac70040261”  
–2016-11-02 07:24:48-- [http://192.168.1.15/emoncms/input/post.json?node=2&json={humidity:93%,pressure:1010,wind:0,temp:0.2,dewpoint:-1,visibility:N/A,rain:%200,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey=913f557706d069745bfe8dac70040261](http://192.168.1.15/emoncms/input/post.json?node=2&json=%7Bhumidity:93%25,pressure:1010,wind:0,temp:0.2,dewpoint:-1,visibility:N/A,rain:%200,windchill:0,feelslike:0,windgust:0,raintoday:0%7D&apikey=913f557706d069745bfe8dac70040261)  
Connecting to 192.168.1.15:80… connected.  
HTTP request sent, awaiting response… 200 OK  
Length: 47 [application/json]  
Saving to: ‘STDOUT’

- 

```
                                                 0%[] 0 --.-KB/s Error: Format error, json value is not numeric

```

- 

```
                                               100%[========================================================================================================================>] 47 --.-KB/s in 0s

```

2016-11-02 07:24:48 (620 KB/s) - written to stdout [47/47]

with double quotes around key with script:

Current temperature in Aspen Crescent, Edmonton is: 0.3  
Current relative humidity in Aspen Crescent, Edmonton is: 93%  
Current pressure in Aspen Crescent, Edmonton is: 1015  
Current wind speed in Aspen Crescent, Edmonton is: 0  
http://192.168.1.15/emoncms/input/post.json?node=2&json={humidity:93%,pressure:1015,wind:0,temp:0.3,dewpoint:-1,visibility:N/A,rain: 0,windchill:0,feelslike:0,windgust:0,raintoday:0}&apikey="913f557706d069745bfe8dac70040261"{"success":false,"message":"Username or password empty"}

Paul - do you have those parse tests you do, could I get a copy and add it to this script. Thx

Could this be a permission setting somewhere, a file or directory that is hit because it is run locally - I’ll double check permissions

* * *

Found it!!!

At some point Wunderground changed the value they send for the “RAIN” attribute. It had leading whitespace — which was starring me in the face when I looked at Paul’s post 🙂

added: $precip\_1hr\_metric = trim($precip\_1hr\_metric, " ");  
removed: double quotes around apikey - indicated invalid key

and voila!!!

Thank you for the help!!

Would still love to see your validation of attributes Paul -thx

[Next page](https://community.openenergymonitor.org/t/api-returns-username-or-password-empty-response-from-localhost/1950.md?page=2)
