2020-08-09, 02:12
Answering my own question above.... I would have NEVER figured this out until I ran into a web site that does Curl to PHO conversion.
https://incarnate.github.io/curl-to-php/
I entered:
and it output this:
It works like a charm... I was able to tweak things to adapt to my needs.
I hope this helps someone. I found that site purely by luck.
Thanks,
H.
https://incarnate.github.io/curl-to-php/
I entered:
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://kodi:[email protected]:80/jsonrpc
and it output this:
php:// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://kodi:[email protected]:80/jsonrpc');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\", \"params\":{\"directory\":\"smb://TOWER/Media/Music Shows/\"}, \"id\": \"mybash\"}");
$headers = array();
$headers[] = 'Content-Type: application/json;';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
It works like a charm... I was able to tweak things to adapt to my needs.
I hope this helps someone. I found that site purely by luck.
Thanks,
H.