Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using PHP to get number of users in Darwin



At 20:05 19/11/2005, you wrote:
Message: 2
Date: Fri, 18 Nov 2005 16:56:14 -0800
From: Graham Anderson <email@hidden>
Subject: Using PHP to get number of users in Darwin
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Is it possible to get the number of connected users on DSS with PHP
and/or some cgi script ?
I need to do this for a live streaming event....
So, basically, if there more than 150 users on a server....go to the
next server

I can make it happen if I can communicate with Darwin in some way :)

<?php
if(numConnectedUsers >200){
//goto this server
}
?>

Or, is there some kind of live updated text file that contains this info
If so, then I can fread the text file.

It does seem to be - I might try this out tomorrow night as I'm planning to put together some admin objects in PHP to do stuff like this. The documentation here http://developer.apple.com/documentation/quicktime/QTSS/QTSS.pdf on page 133-137 documents a GET request syntax to ask the server for all sorts of stuff.


I gues that's what the CGI admin scripts do - I'm not too hot on Perl so in some ways it's easier to write it and try in PHP than to decipher the perl !

Page 137 states "A request like the following can be used to monitor the session list"

GET /modules/admin/server/qtssSvrClientSessions/*

So you'd pass that to your DSS - I'd probably consider using CURL, because I suspect you're going to be asked for HTTP basic authentication and it's fiddly to do from the PHP fopen() command. Obviously for security you'll want to configure your server to only listen to requests from PHP on a particular subnet, preferably a distinct separate network adapater than the one used to deliver the content !

It looks like that command will then respons with http headers and a line by line list of session IDs

Container="/admin/server/qtssSvrClientSessions/"
12/
2/
4/
8/
error:(0)

So a quick count() of the response lines should be enough, or you could regex them to make sure they are numeric session IDs.

HTH
Cheers - Neil

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Streaming-server-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/streaming-server-users/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.