My guess would be the Password you’ve used has a “special” character in it. Typically this would be anything that’s not Alpha-numeric.
If this is the case, then you’ll need to URL-Encode that when you build the URL call in [tt]wget[/tt] ([tt]curl[/tt], etc). Most browsers will auto-convert user-entered URLs to URL-encode stuff for you, so you may not notice it in a direct call.
The other possibility is that the receiving end is fussy about Headers being sent in the request. If this is the case, you’d need to work out which headers it’s fussy about and add them to the curl version of the script
I also tried this form with the same result. I would guess the results here would not be what I want anyway since the ftp settings also have a user and pwd parameter.
I also tried this form with the same result. I would guess the results here would not be what I want anyway since the ftp settings also have a user and pwd parameter.
local url = require("socket.url")
local link = url.escape(string.format("http://192.168.1.105:8090/set_ftp.cgi?upload_interval=10,5,myuser,mypwd"))
luup.inet.wget(link)
Using this to get callerid from a fritzbox on a mythfrontend.
As I recall lua uppercased or lowercased the headers to conform to the standards.
The problem is that many web services do NOT conform to the standards.
So you have to manually added headers of the appropriate case to your request.
A lot of extra BS for something that should be a one liner …
Welcome to the world of programming!
… it does, but you only run into issues if you use LuaSocket for the HTTP calls themselves, and the receiving end isn’t standards compliant.
In this case, @capjay’s recommendation was to use [tt]os.execute()[/tt] and [native] curl. With a later recommendation, from @j.hoekstra, to use the URL-encoding methods of LuaSocket.
Ultimately, with this combination, they shouldn’t run into the LuaSocket HTTP problem you’re citing… but it’ll definitely be worthwhile maintaining the Header case in the curl call “just in case” the Foscam is non-standard.
Thanks guys - with your help and suggestions I’ve figured out what is going on.
The foscam set_alarm.cgi implementation works fine, but the foscam set_ftp.cgi implementation is not recognizing the user and password. When I used Chrome to invoke the set_ftp.cgi url I had to physically log-on before it would proceed and work. Whereas I did not need to physically log-on when invoking the set_alarm.cgi url.
Best Home Automation shopping experience. Shop at Ezlo!