PHP Classes

File: tests/test_user_example.php

Recommend this page to a friend!
  Packages of Matthew Asham   Binkterm PHP   tests/test_user_example.php   Download  
File: tests/test_user_example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Binkterm PHP
Bulletin board system based on the Web
Author: By
Last change:
Date: 5 days ago
Size: 1,587 bytes
 

Contents

Class file image Download
<?php

require_once __DIR__ . '/../vendor/autoload.php';

use
BinktermPHP\Nodelist\NodelistManager;

$nodelistManager = new NodelistManager();

echo
"Testing with user's specific example: 2:5034/10\n\n";

$testAddress = '2:5034/10';
$criteria = ['search_term' => $testAddress];
$results = $nodelistManager->searchNodes($criteria);

if (
$results && count($results) > 0) {
    echo
"? Found " . count($results) . " result(s):\n";
    foreach (
$results as $node) {
        echo
" {$node['full_address']} - {$node['sysop_name']} ({$node['location']})\n";
        if (isset(
$node['system_name']) && $node['system_name']) {
            echo
" System: {$node['system_name']}\n";
        }
        if (isset(
$node['phone']) && $node['phone'] && $node['phone'] !== '-Unpublished-') {
            echo
" Phone: {$node['phone']}\n";
        }
    }
} else {
    echo
"? No results found for {$testAddress}\n";
    echo
"This specific address may not exist in the current nodelist.\n\n";
   
   
// Let's check what zone 2 addresses do exist
   
echo "Checking for any Zone 2 addresses...\n";
   
$zone2Results = $nodelistManager->searchNodes(['zone' => 2]);
    if (
$zone2Results && count($zone2Results) > 0) {
        echo
"Found " . count($zone2Results) . " nodes in Zone 2, showing first 5:\n";
        foreach (
array_slice($zone2Results, 0, 5) as $node) {
            echo
" {$node['full_address']} - {$node['sysop_name']} ({$node['location']})\n";
        }
    } else {
        echo
"No Zone 2 addresses found in this nodelist.\n";
    }
}

echo
"\nTesting completed.\n";