![]() |
v18 POST request to turn off - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174) +---- Thread: v18 POST request to turn off (/showthread.php?tid=336134) Pages:
1
2
|
POST request to turn off - 2054you - 2018-10-04 After updating libreelec on raspberry pi3, the line that turned off the device stopped working: What should be the post request for shutdown in the new version? or better to set up an old version of libreelec with an old version of kodi? RE: POST request to turn off - 2054you - 2018-10-04 can't see string in my post getURL('http://IP:PORT/jsonrpc?request={"jsonrpc":"2.0","method":"System.Shutdown","id":1}'); RE: POST request to turn off - Klojum - 2018-10-04 (2018-10-04, 18:15)2054you Wrote: can't see string in my postFixed. ![]() Somehow the syntax selection went wrong. Just enter the type of code applicable in a syntax tag, in this case json. RE: POST request to turn off - MrTarantula - 2018-10-04 Remove everything after the question mark from the url. Change the method from getURL to whatever the POST equivalent is in the language you're using. Set the type of request to "application/json". Take the JSON (everything after "request=") and set that as the POST body. RE: POST request to turn off - 2054you - 2019-01-06 getURL('http://IP:PORT/jsonrpc?request={"jsonrpc":"2.0","method":"System.Shutdown","id":1}'); Quote:Remove everything after the question mark from the urlgetURL('http://IP:PORT/jsonrpc?'); Quote:Change the method from getURL to whatever the POST equivalent is in the language you're using$_POST('http://IP:PORT/jsonrpc?'); Quote:the type of request to "application/json"$_POST('http://IP:PORT/application/json'); Quote:Take the JSON (everything after "request=") and set that as the POST body.$_POST('http://IP:PORT/application/json{"jsonrpc":"2.0","method":"System.Shutdown","id":1}'); this does not work, I've to turn off the updated kodi hosts by turning off the power, it's the only way PS. what version of Kodi should I install to make my queries work as before? RE: POST request to turn off - ncarthy - 2019-01-06 Remove the '?' from the url RE: POST request to turn off - MrTarantula - 2019-01-06 It looks like you're using PHP. If so, that's not how you use $_POST, and the URL's you created are not how you create a POST request. If you're wanting to POST from PHP, look here. Then go back and look at my previous posts. RE: POST request to turn off - MrTarantula - 2019-01-06 However, if you're trying to use a button or form to turn it off, then you should look at how to post using JavaScript. RE: POST request to turn off - 2054you - 2019-01-06 (2019-01-06, 22:13)MrTarantula Wrote: It looks like you're using PHPyes not a programmer, use this in the project of home automation (2019-01-06, 22:13)MrTarantula Wrote: look here.tried to use something like that, but to no avail thanks anyway RE: POST request to turn off - ncarthy - 2019-01-07 Are you getting any error messages? RE: POST request to turn off - 2054you - 2019-01-08 (2019-01-07, 10:54)ncarthy Wrote: Are you getting any error messages?yes Quote:Fatal error: Function name must be a string in /var/www/modules/scripts/scripts.class.php(150) : eval()'d code on line 1 RE: POST request to turn off - ncarthy - 2019-01-08 That error is likely a problem with the mix of ' and " parenthesis in line one. If you want simple PHP control of Kodi then no need to re-invent the wheel. Have a look in GitHub at how other people are using PHP to control Kodi. Here is an example: https://github.com/KiboOst/php-Kodi-jsonAPI … its just the first item in a google search for "Kodi api PHP" so there will be plenty more examples around the web for you. RE: POST request to turn off - 2054you - 2019-01-10 (2019-01-08, 19:28)ncarthy Wrote: That error is likely a problem with the mix of ' and " parenthesis in line one.I don't want to re-invent the wheel, all I want is to replace one goodworking (before useless updates) string Quote:getURL('http://IP:8080/jsonrpc?request={"jsonrpc":"2.0","method":"System.Shutdown","id":1}');with another, that's all RE: POST request to turn off - 2054you - 2019-07-28 is there a solution how to turn off kodi/libreelec by POST request using php? tired of restoring backups due to shutdown by power off devices RE: POST request to turn off - MrTarantula - 2019-07-29 Look at the code repository ncarthy posted above, specifically the How-to section of the README: Quote: Include it in your PHP like this:
Then use it like this:
|