Scroll down to see page response | Reload this page with no query string | log file
Because this page runs on my Raspberry Pi, it cannot use .user.ini so, at this point, we load a PHP configuration file loaded htaccess.php
This page sends an http request to a specified server and records the response in a log file. It sends an SMS message to warn of a server 's non-response. To get this page to do anything, the query string must specify a 'cron' parameter, so select one from the list below.
Note: during testing, it might be helpful to inhibit the sending of SMS messages. To inhibit SMS messages, by adding sms=no to the query string, tick this box: not implemented yet - needs page to be converted to a FORM
Note: check whether catalogue file sets _SMS_INHIBIT.
Further detailed notes are given in the individual PHP files, and will be moved here in due course.
Note: To simulate a server non-response, a bad port is specified in the catalogue this page is run with cron=badport. This may take a while t ocomplete because the progra mwill try multiple times, with an interval between. If the connection timeout is 10s and the retry interval is 30s, it will take 80s to get an answer. Also, be eware that repeated attemnpts to access a non-existent port might trigger a security error.
How this page works: If no cron parameter is given, this page does nothing other than display the above text. If a cron parameter is given, then at this point, the page includes some PHP files and executes the PHP function main() to set the ball rolling. Various other PHP functions will execute and probably output some debugging information, which will display below. When everything is complete, main() will return some data, which is also echoed below.
Loading catalogue...
Loading new_ping.php...This is new_ping.php
Loading main...
Loading ping_a_server...
Loading sms_via_api...
Running main()...get_headers() was run on pooles.bcra.org.uk:8080 and returned this array...
Array ( [0] => HTTP/1.0 401 Unauthorized [1] => Date: Sun, 22 Dec 2024 06:54:03 GMT [2] => Server: Boa/0.94.13 [3] => Connection: close [4] => WWW-Authenticate: Basic realm="DSL-N14U" [5] => Content-Type: text/html; charset=ISO-8859-1 [6] => Set-Cookie: SESSIONID=2c3ae4d6; path=/ )DEBUG: defined('_TARGET_PORT_B')get_headers() was run on pooles.bcra.org.uk:3927 and returned this array...
Array ( [0] => HTTP/1.1 200 OK [1] => Date: Sun, 22 Dec 2024 06:54:03 GMT [2] => Connection: close [3] => Content-type: text/html; charset=utf8 [4] => Content-length: 1772 [5] => Server: TwistedWeb/2.0.1 )write_log_continuation() says
.main() responded with ...
Array ( [http] => HTTP/1.0 401 Unauthorized [elapsed] => 0.3 [errstr] => [host] => pooles.bcra.org.uk [port] => 8080 [path] => [timeout] => 15 [server] => Server: Boa/0.94.13 [whoAmI] => [link_ok] => 1 [attempts] => 2 [server_B] => Server: TwistedWeb/2.0.1 [http_B] => HTTP/1.1 200 OK [port_B] => 3927 [errstr_B] => [cron] => yes [continues] => 1 [lastWell] => 1734850444 [changed] => xchange [lastAlert] => 1732511046 )
END