获取命令php的输出 - shell_exec

时间:2017-02-10 13:55:17

标签: php echo shell-exec libspotify

我正在使用名为spop的spotify插件:https://github.com/Schnouki/spop

现在我想创建一个传递命令并返回字符串的搜索系统,然后我可以解析它并使其可读等。

如果我这样做,它可以工作,返回我想要的东西:

echo shell_exec('echo hello'); //returns hello

现在我想做(不返回任何内容):

echo shell_exec('echo search "new release 2017" >/dev/tcp/localhost/6602'); //Returns nothing

有什么想法吗?现在我尝试了<pre>$output</pre>。描述:http://php.net/manual/en/function.shell-exec.php#example-4218

我只想返回搜索命令的输出。我应该收到像这样的东西:

{"query":"new release 2017","uri":"spotify:search:new+release+2017","total_tracks":12,"tracks":[{"artist":"Suresh Parik","title":"Aa Dado Sa Ri Laadli","album":"Rajasthani New Release 2017","duration":382000,"uri":"spotify:track:43tKsH7K2FUOSd4mnutx3m","available":true,"popularity":0,"index":1},{"artist":"Shyam Singh","title":"Bhajan Me Java Koni De","album":"Rajasthani New Release 2017","duration":338000,"uri":"spotify:track:4AdNsTGLKfyAehLXrXmSUK","available":true,"popularity":0,"index":2},{"artist":"Hamira Ram Raika","title":"Bhanwar Sa Mhasu Milta Jaijo","album":"Rajasthani New Release 2017","duration":370000,"uri":"spotify:track:7hEeZk8Fvb8AFd2ps553lq","available":true,"popularity":0,"index":3},{"artist":"Hamira Ram Raika","title":"Dhola Dhola Dhotiya","album":"Rajasthani New Release 2017","duration":416000,"uri":"spotify:track:5YnLliPcOm4Qb1ay2SiTPm","available":true,"popularity":0,"index":4},{"artist":"Papu Artiya","title":"Doda Mat Pi Dokriya","album":"Rajasthani New Release 2017","duration":359000,"uri":"spotify:track:3EjwwyV5qUPffTRUdeOQGV","available":true,"popularity":0,"index":5},{"artist":"Kuldeep Ojha","title":"Gora Gora Gaal","album":"Rajasthani New Release 2017","duration":528000,"uri":"spotify:track:4WlHzN1FSXygCpuPqGLGvY","available":true,"popularity":0,"index":6},{"artist":"Hamira Ram Raika","title":"Jorji Champawat","album":"Rajasthani New Release 2017","duration":557000,"uri":"spotify:track:0ixmKnWl9E2adeEvbHqD6k","available":true,"popularity":0,"index":7},{"artist":"Natwar Jhitra","title":"Maa Ka Palda Bhari Hai","album":"Rajasthani New Release 2017","duration":654000,"uri":"spotify:track:33t5kA8V5dmzdcyWPfy4th","available":true,"popularity":0,"index":8},{"artist":"Ramesh Lohiya","title":"Mele Khele Jao Bhanwar Ji","album":"Rajasthani New Release 2017","duration":304000,"uri":"spotify:track:0JodbnP1tyX6oorRmWOkxC","available":true,"popularity":0,"index":9},{"artist":"Nena Ram Dewasi, Chhotu Banna","title":"Nach Nach Mhara Sang Ra Sathi","album":"Rajasthani New Release 2017","duration":285000,"uri":"spotify:track:5FQKtFPwOYUHaNDAtN9sWn","available":true,"popularity":0,"index":10},{"artist":"Kamlesh Singh","title":"Odh Lugadi Pilo Byayan","album":"Rajasthani New Release 2017","duration":404000,"uri":"spotify:track:2VPNimxfZOmb33kChjcm2c","available":true,"popularity":0,"index":11},{"artist":"Adrian Zenith","title":"Release Yourself - Digital Energy Remix","album":"Happy New Year from Trance of Ibiza 2017","duration":497000,"uri":"spotify:track:4krqyIAazX3R1TVbBxyTB5","available":true,"popularity":0,"index":12}],"total_albums":1,"albums":[{"artist":"Various Artists","title":"Rajasthani New Release 2017","available":true,"uri":"spotify:album:0u1e7VZzl59NWxvIdWyquT"}],"total_artists":0,"artists":[],"total_playlists":6,"playlists":[{"name":"Winter 2017 Country playlist","uri":"spotify:user:1228804577:playlist:0Yzxp6mxnuBfrtVzlxG03h"},{"name":"Top New Songs 2017","uri":"spotify:user:22geympzgpcckueuh7ry6rvqy:playlist:7CPOFZtGed5SE0XhMHmiep"},{"name":"2017 New Release","uri":"spotify:user:teamwork1:playlist:1iJy5jsCvHpp1jDWLtDhIE"},{"name":"2017 New Release & Hit Parade","uri":"spotify:user:12150104486:playlist:6n75nX7NBRCn2cXsmT4eHf"},{"name":"Jetsetter 2017 (EDM Elixir) | Updated Weekly","uri":"spotify:user:126414896:playlist:0JUtq7lLoahjuXZQARW13U"},{"name":"UNFD 2017","uri":"spotify:user:unfdcentral:playlist:2Lbl7gTrFYREhHEGUV4ZNZ"}]}

0 个答案:

没有答案
相关问题