(PECL gupnp >= 0.1.0)
Start browsing
bool gupnp_control_point_browse_start ( resource $cpoint )
Start the search and calls user-defined callback.
Parameters:
cpoint
A control point identifier, returned by gupnp_control_point_new().
Returns:
Returns TRUE
on success or FALSE
on failure.
Examples:
Create new UPnP context and start browsing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <?php function device_proxy_available_cb( $proxy , $arg ) { $info = gupnp_device_info_get( $proxy ); $type = $info [ 'device_type' ]; $location = $info [ 'location' ]; printf( "Device available:\n" ); printf( "type: %s\n" , $type ); printf( "location: %s\n" , $location ); } /* Create the UPnP context */ $context = gupnp_context_new(); if (! $context ) { die ( "Error creating the GUPnP context\n" ); } /* We're interested in everything */ $cp = gupnp_control_point_new( $context , "ssdp:all" ); gupnp_control_point_callback_set( $cp , GUPNP_SIGNAL_DEVICE_PROXY_AVAILABLE, 'device_proxy_available_cb' ); /* Start for browsing */ gupnp_control_point_browse_start( $cp ); ?> |
See also:
Please login to continue.