Hello
You could use your external php script to query against serverinfo or connection counts http providers to see what type of streams are currently published. If it is not exactly (or all) of what you need, you can modify this code as the source is provided here.
Alternatively, you might look at our REST API as you can run a simple GET query against an application instance to see its incoming streams. Example cURL request:
curl -X GET --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/[app-name]/instances/_definst_
Would return something similar to:
{[B]"incomingStreams":[{"sourceIp":"rtmp://127.0.0.1:64453","isPTZEnabled":false,"applicationInstance":"_definst_","name":"[app-name]","isRecordingSet":false,"isStreamManagerStream":false,"isPublishedToVOD":false,"isConnected":true,"ptzPollingInterval":2000}][/B],"outgoingStreams":[],"recorders":[],"streamGroups":[],"name":"_definst_"}
Thanks,
Matt