Page 1 of 1

Access http interface from php script

Posted: 19 Sep 2008 11:11
by Eagle_Erwin
Last week I updated form 0.8.6i to 0.9.2. Since then, I can't access the http-interface from a php-script with the command:

Code: Select all

file_get_contents("http://server:port/requests/status.xml");
It keeps loading and then times out. The page is reachable from Firefox and IE7. I've modified the .hosts-file, so it has to accept connections from all ip's and all interfaces.
Did the makers add some kind of protection against access from php-scripts that can be disabled, or do I have to do something else?

Re: Access http interface from php script

Posted: 19 Sep 2008 21:15
by dionoea
It's probably something else. Do you see the connection attempts in the VLC debug output?

Re: Access http interface from php script

Posted: 19 Sep 2008 22:15
by Harl
I have the same problem. I am using Java http client to read pages I generate with my custom http interface with RPN commands. The problem here is that the connection is not closed and the client waits and then time-outs. This applies for xml pages generated with RPN. Normal html pages work fine - connection is closed as expected.

You can check it with a request from firefox/IE and checking netstat -t in command line. It will show that the connection remains ESTABLISHED after you request e.g. status.xml page.

Re: Access http interface from php script

Posted: 20 Sep 2008 00:35
by dionoea
Ah ok, someone provided a patch a few weeks ago to fix this issue but we didn't apply it since nobody could tell if it was ok or not :) Maybe that's linked. Please post in this thread tomorrow to ask me to investigate further. I'll provide test builds for those who want (windows test builds).

Re: Access http interface from php script

Posted: 20 Sep 2008 08:10
by Harl
Can you please tell me where to get those test builds from ? I can test them. Thank you.

Re: Access http interface from php script

Posted: 20 Sep 2008 13:08
by Eagle_Erwin
I'm glad to hear that I'm not the only one with the problem. I'm also very interested in the test builds.

Re: Access http interface from php script

Posted: 23 Sep 2008 01:28
by dionoea
0.9.3-git builds with patch from viewtopic.php?f=18&t=50480 applied are available here:
http://people.videolan.org/~dionoea/vlc ... x-win32.7z

Please report if they fix (or don't fix) your problem.

Thanks, (and sorry for the slight delay)

Re: Access http interface from php script

Posted: 23 Sep 2008 01:44
by dionoea
According to thedj that fix isn't correct ... but check if it works anyway ... might be helpful for people debugging.

Re: Access http interface from php script

Posted: 23 Sep 2008 20:44
by Harl
He is right. It's not fixed. The http connection is not closed.

Re: Access http interface from php script

Posted: 23 Sep 2008 23:01
by Eagle_Erwin
0.9.3-git builds with patch from viewtopic.php?f=18&t=50480 applied are available here:
http://people.videolan.org/~dionoea/vlc ... x-win32.7z

Please report if they fix (or don't fix) your problem.
The fix solved my problem, PHP scripts can now access the http pages through the function file_get_contents() without timing out. Thanks!

Re: Access http interface from php script

Posted: 24 Sep 2008 11:42
by dionoea
Ah well ... looks like the fix was correct after all. It should be included in the next release.