Set value of a String using HTTP GET?

I’ve been searching the wiki and forums but no luck yet…

I can successfully update a number item using the HTTP GET option with the following URL…

http://192.168.1.90:8080/CMD?Temp01=28

But I can’t seem to update a String item, is there a slightly different syntax? I’ve tried double quotes, single quotes etc etc////

Did you try nothing at all? If your String has spaces use the URL escaped version if space. %20

I have this exact problem.
Did you make it at the en? If so, how? This is what I’m trying

String External_IP "[%s]" <present> {http="<[http://smart-ip.net/myip:60000:REGEX((.*))]"}

On the log I’m getting the following:

2016-03-20 14:35:02.441 [WARN ] [g.openhab.io.net.http.HttpUtil] - Method failed: HTTP/1.1 403 Forbidden

The web server listening at smart-ip.net and receiving the /myip HTTP GET request is appearing to reject the request due to a lack of authorization. You will have to find out what kind of authentication that server is looking for, and then find a way to provide it. Possible choices include HTTP headers, cookies, Basic Authentication, Digest Authentication, URL parameters…

An alternative service that reports your external IP address, like checkip.dyndns.com, together with a REGEX transform that extracts the sub-part of the response you want, would side-step the authorization issue.

Hello Watou,

The issue is that smart-ip.net does not require any authorization. You can just make
curl smart-ip.net/myip
And you will get the ip without any problem. I don’t know why I’m getting a 403 using the http service. Do you know which protocol version is using? Maybe it is because it uses version 1.0 ?

Hello Watou,

Using the suggested service works without problems. Thank you very much.

This is what I get as response:
<html><head><title>Current IP Check</title></head><body>Current IP Address: 87.218.178.15</body></html>

I’m trying to capture the text using the following Regex:

REGEX(.*<body>(.*)<.body>.*)

But it is not working, it captures the whole string all the time. Do you know what I’m doing wrong?

It suddenly started working, so, cool.
Thank you very much.
Regards

It’s possible that curl is doing something that the HTTP binding isn’t doing. You could run curl with verbose output to see.

Maybe this REGEX expression could extract the IP address:

REGEX(.*(\d+\.\d+\.\d+\.\d+).*)

The one I’m using is working as expected. In any case, your regex is missing the plus sign after each \d, I mean \d+

Thank you.

Ah yes, thanks. Fixed!