examples/AdManager/v201811/NetworkService/GetAllNetworks.php
public static function runExample(
        ServiceFactory $serviceFactory,
        AdManagerSession $session
    ) {
        $networkService = $serviceFactory->createNetworkService($session);

        // Get all networks that you have access to with the current
        // authentication credentials.
        $networks = $networkService->getAllNetworks();

        if (empty($networks)) {
            printf('No accessible networks found.' . PHP_EOL);
            return;
        }

        // Print out some information for each network.
        foreach ($networks as $i => $network) {
            printf(
                "%d) Network with code %d and display name '%s' was found.%s",
                $i,
                $network->getNetworkCode(),
                $network->getDisplayName(),
                PHP_EOL
            );
        }

        printf("Number of results found: %d%s", count($networks), PHP_EOL);
    }
public static function runExample(
        ServiceFactory $serviceFactory,
        AdManagerSession $session
    ) {
        $networkService = $serviceFactory->createNetworkService($session);

        // Get all networks that you have access to with the current
        // authentication credentials.
        $networks = $networkService->getAllNetworks();

        if (empty($networks)) {
            printf('No accessible networks found.' . PHP_EOL);
            return;
        }

        // Print out some information for each network.
        foreach ($networks as $i => $network) {
            printf(
                "%d) Network with code %d and display name '%s' was found.%s",
                $i,
                $network->getNetworkCode(),
                $network->getDisplayName(),
                PHP_EOL
            );
        }

        printf("Number of results found: %d%s", count($networks), PHP_EOL);
    }
public static function runExample ( ServiceFactory $ serviceFactory , AdManagerSession $ session ) { $ networkService = $ serviceFactory -> createNetworkService ( $ session ) ; // Get all networks that you have access to with the current // authentication credentials. $ networks = $ networkService -> getAllNetworks ( ) ; if ( empty ( $ networks ) ) { printf ( 'No accessible networks found.' . PHP_EOL ) ; return ; } // Print out some information for each network. foreach ( $ networks as $ i => $ network ) { printf ( "%d) Network with code %d and display name '%s' was found.%s" , $ i , $ network -> getNetworkCode ( ) , $ network -> getDisplayName ( ) , PHP_EOL ) ; } printf ( "Number of results found: %d%s" , count ( $ networks ) , PHP_EOL ) ; }
Gets all networks.

@param ServiceFactory $serviceFactory the factory class for creating a
network service client
@param AdManagerSession $session the session containing configurations
for creating a network service client
@throws ApiException if the request for getting all networks fails
Gets all networks .