<?php function stream_notification_callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) {
switch($notification_code) { case STREAM_NOTIFY_RESOLVE: case STREAM_NOTIFY_AUTH_REQUIRED: case STREAM_NOTIFY_COMPLETED: case STREAM_NOTIFY_FAILURE: case STREAM_NOTIFY_AUTH_RESULT: var_dump($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max); /* 無視 */ break;
case STREAM_NOTIFY_REDIRECTED: echo "Being redirected to: ", $message; break;
case STREAM_NOTIFY_CONNECT: echo "Connected..."; break;
case STREAM_NOTIFY_FILE_SIZE_IS: echo "Got the filesize: ", $bytes_max; break;
case STREAM_NOTIFY_MIME_TYPE_IS: echo "Found the mime-type: ", $message; break;
case STREAM_NOTIFY_PROGRESS: echo "Made some progress, downloaded ", $bytes_transferred, " so far"; break; } echo "\n"; }
Connected...
Found the mime-type: text/html; charset=utf-8
Being redirected to: http://no.php.net/contact
Connected...
Got the filesize: 0
Found the mime-type: text/html; charset=utf-8
Being redirected to: http://no.php.net/contact.php
Connected...
Got the filesize: 4589
Found the mime-type: text/html;charset=utf-8
Made some progress, downloaded 0 so far
Made some progress, downloaded 0 so far
Made some progress, downloaded 0 so far
Made some progress, downloaded 1440 so far
Made some progress, downloaded 2880 so far
Made some progress, downloaded 4320 so far
Made some progress, downloaded 5760 so far
Made some progress, downloaded 6381 so far
Made some progress, downloaded 7002 so far
switch($notification_code) { case STREAM_NOTIFY_RESOLVE: case STREAM_NOTIFY_AUTH_REQUIRED: case STREAM_NOTIFY_COMPLETED: case STREAM_NOTIFY_FAILURE: case STREAM_NOTIFY_AUTH_RESULT: /* 無視 */ break;
case STREAM_NOTIFY_REDIRECTED: echo "Being redirected to: ", $message, "\n"; break;
case STREAM_NOTIFY_CONNECT: echo "Connected...\n"; break;