Page 1 of 1

http request

Posted: 14 Apr 2008 14:43
by CurrySven
Hi everybody,

i try to control vlc via http... http://ip:port/requests/status.xml?command=pl_pause

than the vlc is stopping.. thats correct... but the xml file open´s ... what should i have to do, that this not happens...

only the command should be done...

Re: http request

Posted: 14 Apr 2008 15:28
by revolunet
The xml file is the response for your command so it is normal;

if you dont want to have any answer, use a command line 'browser' like wget or w3m

Re: http request

Posted: 14 Apr 2008 15:36
by CurrySven
Oh, okay.... then the link or command has to look like????

Re: http request

Posted: 14 Apr 2008 15:43
by revolunet
just use :

Code: Select all

wget http://ip:port/requests/status.xml?command=pl_pause

Re: http request

Posted: 14 Apr 2008 16:07
by CurrySven
i thinks its an linux command... so, i use win... I don`t have any ideas... i have to import the content dynamic... the best way is to use a php script.. but i have no ideas....

Re: http request

Posted: 14 Apr 2008 16:10
by revolunet
if you want PHP :

Code: Select all

include("http://ip:port/requests/status.xml?command=pl_pause")

but you can also use wget under windows ;) --> http://pages.interlog.com/~tcharron/wgetwin.html

Re: http request

Posted: 14 Apr 2008 16:14
by CurrySven
Yes, but i think the php version is much easier... so, how can i drop a link? for the function pause???

Re: http request

Posted: 14 Apr 2008 16:20
by revolunet
you want the user to click in the interface on a pause button ?

you dont need PHP for that... heres a hint :

Code: Select all

<iframe width=1 height=1 id=VIRTUAL src="about:blank" ></iframe> <button onclick="document.getElementById('VIRTUAL').location='http://ip:port/requests/status.xml?command=pl_pause';">pause</button>
this way the xml is opened in an hidden iframe. you could also use xmlhttprequest

Re: http request

Posted: 14 Apr 2008 16:30
by CurrySven
So, i took the code.. but nothing happen... if i type the link manually in the brower, the vlc stop/pause.... where is the problem...

Re: http request

Posted: 14 Apr 2008 16:34
by CurrySven
the vlc is running on a different pc

Re: http request

Posted: 14 Apr 2008 16:46
by revolunet
increase iframe width and height to see whats happening and USE FIREBUG

also, there may be a caching issue with firefox, you may need to change :

document.getElementById('VIRTUAL').location='http://ip:port/requests/status.xml?command=pl_pause';

to document.getElementById('VIRTUAL').location='http://ip:port/requests/status.xml?command=pl_pause&r=' + Math.random();

Re: http request

Posted: 14 Apr 2008 17:03
by CurrySven
in the iframe does nothing appears.... and firebug is without any mistake.....

Re: http request

Posted: 14 Apr 2008 17:05
by revolunet
check the requests if they are the same that work in the browser directly and then debug

Re: http request

Posted: 14 Apr 2008 17:11
by CurrySven
What do you mean... another function???

Re: http request

Posted: 14 Apr 2008 17:12
by CurrySven
I also tried another function... if i put the link into the browser... everythink is okay...

Re: http request

Posted: 14 Apr 2008 17:19
by CurrySven
At the status window of the vlc does nothing appear....

Re: http request

Posted: 14 Apr 2008 17:25
by revolunet
another way to do it :

add name="VIRTUAL" to the iframe

then try if this works : <a href="http://ip:port/requests/status.xml?command=pl_pause">test</a>

if it works then just add target="VIRTUAL" to the link, this way the link will open in the hidden iframe

Re: http request

Posted: 14 Apr 2008 17:28
by CurrySven
So, this works ;-) if i have another question... can i ask you??? Thanks thanks... thanks...

Re: http request

Posted: 14 Apr 2008 17:37
by revolunet
of course you can, but dont forget to think then test then modify then test then think then modify again ;)

documentation and intensive testing is the best to find out solutions ;)

Re: http request

Posted: 14 Apr 2008 17:44
by CurrySven
Yes.. this is a easy way---- but i didn´t think about it